Hi,
I’ve created a basic ‘Dynamic Template’ in SendGrid for email verification. It currently only contains a brief message and a button to click in order to verify the users’ email address.
The button needs to have the URL that Meteor generates in its ‘sendVerificationEmail’ function.
I’m struggling to get Meteor to use the dynamic template instead of Meteor’s default one. I can’t get Meteor to use SendGrid’s templates using Email.send either.
The verification emails send if I assign this header right before calling the Accounts.sendVerificationEmail function, but the email does not use the template that I have created:
Accounts.emailTemplates.headers = {
"X-SMTPAPI": {
"filters": {
"templates": {
"settings": {
"enable": 1,
"template_id": "X-XXXXXXXXXXXXXXXXXXX"
}
}
},
"sub": {
"{{buttonVerificationLink}}": "https://www.google.com",
"{{verificationLink}}": "https://www.google.com"
}
}
}
Similarly, Email.send will also send an email with this configuration (but will not use the template):
Email.send({
from,
to: 'email@address.com',
headers: {
"X-SMTPAPI": {
"filters": {
"templates": {
"settings": {
"enable": 1,
"template_id": "X-XXXXXXXXXXXXXXXXXXX"
}
}
},
"sub": {
"{{buttonVerificationLink}}": "https://www.google.com",
"{{verificationLink}}": "https://www.google.com"
}
}
}
});
What am I missing? Has anyone else managed to get SendGrid’s dynamic templates working with Meteor’s Email package or with the email function (verify, reset password, etc)?
I found a few questions on Meteor & StackOverflow but had no luck with their solutions. Most of them are a few years old.