-
Notifications
You must be signed in to change notification settings - Fork 0
/
MailComponent.cs
28 lines (26 loc) · 985 Bytes
/
MailComponent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using SendGrid;
using SendGrid.Helpers.Mail;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace AzureMail
{
class MailComponent
{
public static void SendMail(string content)
{
var client = new SendGridClient("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");
var msg = new SendGridMessage();
msg.SetFrom(new EmailAddress("[email protected]", "MOM"));
var recipients = new List<EmailAddress>
{
new EmailAddress("[email protected]"),
new EmailAddress("[email protected]"),
new EmailAddress("[email protected]")
};
msg.AddTos(recipients);
msg.SetSubject("Mail from Azure and SendGrid");
msg.AddContent(MimeType.Text, content);
client.SendEmailAsync(msg);
}
}
}