Sendgrid-csharp: multiple recipients

Created on 24 Jun 2016  路  3Comments  路  Source: sendgrid/sendgrid-csharp

Issue Summary

When using the email helper to send an email to multiple recipients, only the first recipient receives the email.

Steps to Reproduce

  1. set recipients like "[email protected],[email protected]"
  2. send the email to the recipients
  3. only [email protected] received the email, though "[email protected]" is shown in the recived email "To" field

Would be nice to have multi recipients supported. Cheers,

Technical details:

  • sendgrid-csharp Version: master (latest commit: [commit number])
  • .NET Version: 4.5.2
help wanted question

All 3 comments

Can you add more information? Using the latest version (7.0.2), I can send to multiple recipients like this:

Personalization personalization = new Personalization();
email = new Email();
email.Name = "Example User";
email.Address = "[email protected]";
personalization.AddTo(email);

        email2 = new Email();
        email2.Name = "Example User2";
        email2.Address = "[email protected]";
        personalization.AddTo(email2);

Thanks for the quick reply. Never used Personalization, will have a look.

Here is the code I used to send email,

dynamic sg = new SendGridAPIClient(apiKey);

SendGrid.Helpers.Mail.Email from = "[email protected]";
Email to = new Email("[email protected],[email protected]");
Content content = new Content("text/plain", body);
Mail mail = new Mail(from, subject, to, "testing");

dynamic response = sg.client.mail.send.post(requestBody: mail.Get());

@lijaso,

Here is an example with multiple recipients: https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/Example/Example.cs#L47

@yielr thanks for providing some help!

Was this page helpful?
0 / 5 - 0 ratings