I need to use the email that will be the recipient of the sendgrid template email inside the template itself. I could send it as a parameter, but it isn't desirable as I can send (By API) one only request with a array of recipients. How do I use the recipient email as a parameter inside the template?
Something like {{{recipient}}}...
The email are being sent by a NodeJS Express back-end in the following way:
public async sendTransactionalMail(title: string, template_id: string, recipients: string[], template_data: any) {
const template_data_to_send = {...template_data, subject: title};
const msg = {
to: recipients,
from: 'email@email.com',
templateId: template_id,
dynamicTemplateData: template_data_to_send
};
return await mail.send(msg);
}