Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var message = new MailMessage();
- foreach (string e in userEmails)
- {
- message.To.Add(new MailAddress(e));
- }
- message.From = new MailAddress("*******@gmail.com", "Site Name");
- message.Subject = string.Format("{0} vs {1}", teamZero.Name, teamOne.Name);
- message.Body = body;
- message.IsBodyHtml = true;
- using (var smtp = new SmtpClient())
- {
- var credential = new NetworkCredential
- {
- UserName = "**********",
- Password = "**********"
- };
- smtp.Credentials = credential;
- smtp.Host = "smtp.gmail.com";
- smtp.Port = 25;
- smtp.EnableSsl = true;
- try
- {
- await smtp.SendMailAsync(message);
- return "";
- }
- catch (Exception e)
- {
- return e.InnerException.Message;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement