Two different events with different email addresses are sent to the first email address
Hello, I have been using novu for a short time in my work. I have been using it regularly to send emails . I am working with nestjs framework.
My previous tasks were only related to sending one email at a time, however, I am on a task where I need to send two consecutive emails, to two different events: one to notify the user and one to notify an administrator.
My problem is that, although I send both events with the specific subscriber information to each one, both emails always arrive only to one of the emails.
I have a method in my communication service to send any type of event and content:
When I use it, I call runs with waiting for each step to be executed, inside a try/catch
When calling each execution of the method to send the email I have checked that each email is the correct one, and it is always the one I have indicated, however both still arrive only to the user's notification email.
Any idea what might be going on?
5 Replies
@George
@Esteban Alvarado
By any chance, admin email and subscriber email could be same?
Could you please share transactionId ? I will check the root cause
Hey, Thanks! I print first the
to
object of each event trigger, and as you can see each email and subscriber id is different.
Also, I'm showing the result data with the transactions id.
I also attach a screenshot of the subscribers table in the novu dashboard.@Pawan Jain I have also tried to use a direct email address in the code, instead of the environment variable and it still skips sending to this address and still sends both emails to the user.
@Pawan Jain Hello, I have managed to solve the problem, I was sending in the payload a property called email, which overwrote the email to which it should be sent. Thanks anyway!
Thanks for the update @Esteban Alvarado
As email is system variable, it should not be used as payload dynamic variable