Closed ynagarjuna2012 closed 7 years ago
Hello @ynagarjuna1995,
The SMTP API functionality is now built into the v3 /mail/send endpoint.
You will want to set a personalization block for each to email.
Here is an example with 2 personalization blocks using our mail helper: https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php#L22
Please let us know if you need additional help.
With Best Regards,
Elmer
Based on this: https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html#-Sending-the-same-Email-to-Multiple-Recipients adding multiple To's results in "These recipients will all be able to see each other on the email."
Thanks for jumping in @mikegreen!
Thanks - so that leaves me wondering - is there a way to dispatch multiple emails with a single "to" in one call? I didn't find an obvious way so I just make a gaggle of calls (not a problem when sending 150 emails at a time.. but thousands? eek).
@mikegreen Feeling same. They don't have implementation to pass multiple emails with single to .. according to @thinkingserious we need to build 'n' personalization objects for sending 'n' different mails.
Hope Sendgrid will provide better way to implement this :)
@mikegreen you can have multiple personalizations in the same call.
@ynagarjuna1995 we are definitely open to ideas on better methods. Personally, I think the personalizations route is a much better approach versus our v2 endpoint.
Please follow this issue for progress. Thank you!
const msg = { to: ['test@yopmail.com', 'test@gmail.com'], from: 'desk@yopmail.com', subject: subject, html: html, }; sgMail.send(msg).then(() => { }, error => { console.error(error ,'inside then'); if (error.response) { console.error(error.response.body ,'inside then if condition') } }) .catch((err) => { console.log(err, 'inside catch'); });
2021 checking in. :D
Was there ever a solution to this?
I tried using a Personalization
in the Java library, but every address entered in the "to" field will still see every other address, which is problematic in a number of ways and likely a GDPR violation, so it's unfortunately a no go.
Any other solution? Or do we have to call the API once per email?
@nyvelius yes they got a solution dosc
just use
{ to: [ { email: email, }, ], }, { to: [ { email: email, }, ], },
instead of
{ to: [ { email: email, }, { email: email, }, ], }
Is there a way to send in one request multiple template_id,so not just to have multiple users example: { to: [ { email: email, }, ], }, { to: [ { email: email, }, ], },
but for each section of to to have a individual template_id ?
Instead of explicitly passing the to
addresses, is it possible to omit to
and just email all contacts?
Issue Summary
I want to send email to 1000 users with a single api request.
I have used the personalizations addTo() multiple times but it show all the mail ID's in to field.
I don't want to let my users see other email Id's another than his email ID.
Steps to Reproduce
I am using an example which is shown on the Sendgrid Website but it constantly throwing some errors.
Code:
The above code throwing the error. How to send emails to multiple users using Web API V3 or if it is not poosible to send through it.
Please provide the example on how to use send mail with SMTP API