s-ichikawa/laravel-sendgrid-driver

SendGrid Error When Sending Duplicate Email Addresses "Each email address in the personalization block should be unique between to, cc, and bcc."

jakedewitt87 opened this issue · 1 comments

I just switched over to using this package on several of my Laravel projects that before were using SMTP to connect to SendGrid. And now I am starting to see this error pop up on some of those projects:

GuzzleHttp\Exception\ClientException Client error: POST https://api.sendgrid.com/v3/mail/send resulted in a 400 Bad Request response:
{"errors":[{"message":"Each email address in the personalization block should be unique between to, cc, and bcc.

It looks like this is coming up when the same email address is being included twice between the to, cc, and bcc fields when sending emails out. I am curious if there is a way we could potentially solve for this by stripping out duplicates from the BCC, then CC, and then To field before sending the email so as to avoid this issue. Thanks!

Hi,
If the library does too much work, it will be difficult for the user to predict the behavior. So I'm not thinking about having that responsibility in this library for now.
Thank you.