-
Notifications
You must be signed in to change notification settings - Fork 782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template substitutions not being applied after the first email #243
Comments
This is happening for me as well, using the v2 apis and 2.0.0 of the Node library. For me it occurs EVERY time there are multiple recipients. The first recipient gets the replacement as expected, but subsequent emails have blank spaces instead of the replacement text. |
@jasonpang @BrandesEric This issue is similar to this one: sendgrid/sendgrid-java#114 -- please read the solution there. I'll officially address this ticket and make the same updates to the documentation as soon as I can. |
@thinkingserious I'm not sure I understand - we're not doing anything with multiple personalization objects. We're just creating a sendgrid.Email() object and setting substitutions. In our case, we have two recipients, but we specify a single replacement substitution (that is, we want the same value to be replaced in both emails) |
@BrandesEric Ah, sorry I missed that you are using v2 apis. Could you please open a separate ticket and include the relevant source code? Thanks! |
The substitutions used to be an array that matched index for index with the recipients array. Now, each substitution goes to a personalization. Previously, you would do the following: to: email1, email2, email3 Now, you would do the following: personalization1:
personalization2:
personalization3:
etc.. For more on the changes between v2 and v3, please review: https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html |
Referencing this issue, there still seems to be an issue when applying templates to an email. Rarely, one of my emails will have the templates applied (the first one I send after a while), but subsequent emails have the placeholder blank.
Here's the code I'm using. Is there something I'm doing wrong?
My goal is to send transactional emails using a SendGrid template and substituting variables.
Using version 3.0.5 (latest) of the sendgrid library.
The text was updated successfully, but these errors were encountered: