@@ -4,6 +4,7 @@ This documentation provides examples for specific use cases. Please [open an iss
44
55* [ Email - Attachments] ( #attachments )
66* [ Email - Kitchen Sink - an example with all settings used] ( #kitchensink )
7+ * [ Email - Send a Single Email to Multiple Recipients] ( #singleemailmultiplerecipients )
78* [ Email - Send a Single Email to a Single Recipient] ( #singleemailsinglerecipient )
89* [ Email - Transactional Templates] ( #transactional_templates )
910
@@ -307,6 +308,52 @@ namespace Example
307308}
308309```
309310
311+ <a name =" singleemailmultiplerecipients " ></a >
312+ # Send a Single Email to Multiple Recipients
313+
314+ ``` csharp
315+ using SendGrid ;
316+ using SendGrid .Helpers .Mail ;
317+ using System ;
318+ using System .Threading .Tasks ;
319+ using System .Collections .Generic ;
320+
321+ namespace Example
322+ {
323+ internal class Example
324+ {
325+ private static void Main ()
326+ {
327+ Execute ().Wait ();
328+ }
329+
330+ static async Task Execute ()
331+ {
332+ var apiKey = Environment .GetEnvironmentVariable (" NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY" );
333+ var client = new SendGridClient (apiKey );
334+
335+ var from = new EmailAddress (
" [email protected] " ,
" Example User" );
336+ var tos = new List <EmailAddress >
337+ {
338+ new EmailAddress (
" [email protected] " ),
339+ new EmailAddress (
" [email protected] " ),
340+ new EmailAddress (
" [email protected] " )
341+ };
342+ var subject = " Sending with SendGrid is Fun" ;
343+ var plainTextContent = " and easy to do anywhere, even with C#" ;
344+ var htmlContent = " <strong>and easy to do anywhere, even with C#</strong>" ;
345+
346+ var msg = MailHelper .CreateSingleEmailToMultipleRecipients (from ,
347+ tos ,
348+ subject ,
349+ plainTextContent ,
350+ htmlContent
351+ );
352+ }
353+ }
354+ }
355+ ```
356+
310357<a name =" singleemailsinglerecipient " ></a >
311358# Send a Single Email to a Single Recipient
312359
0 commit comments