sendMultiple (only in production mod ) doesn't send email to recipients array
Opened this issue · 4 comments
Deleted user commented
Issue Summary
Hello,
I use the sendMultiple method to send an email to multiple recipients.
When I'm in my development environment, everything works fine. All recipients receive the email.
But in production, only one recipient receives the email.
My environment variables are well informed at my provider.
Thanks for your help.
Code Snippet
import sendgrid from '@sendgrid/mail';
sendgrid.setApiKey(process.env.SENDGRID_API_KEY);
export default async function sendEmailDestinataire(req, res) {
const msg = {
to: req.body.email, // is ['user@domaine1.fr', 'user@domaine2.com']
from: {
email: 'my@email.fr',
name: 'My Name',
},
templateId: 'd-xxxx',
dynamic_template_data: {
name: req.body.name,
email: req.body.email,
message: req.body.message,
file: req.body.file,
},
};
try {
await sendgrid.sendMultiple(msg);
res.json({ message: `Email has been sent` });
} catch (error) {
res.status(500).json({ error: 'Error sending email' });
}
}
Technical details:
- sendgrid-nodejs version: "@sendgrid/mail": "^7.6.1",
- node version: 14.17.6
JenniferMah commented
Hi @StudioOrientExpress! Are there any errors that occur when trying to send to multiple recipients?
Deleted user commented
Hi @JenniferMah,
Send is success without errors. But only one recipient receive email
JenniferMah commented
In order to better serve you, as this does not present itself as a library specific issue, we would like to ask that you reach out to our support team at support.sendgrid.com.
Deleted user commented
Thanks,
Hi send message to support sendgrid.