Skip to content

Instantly share code, notes, and snippets.

@rmgimenez
Created June 6, 2016 20:06
Show Gist options
  • Save rmgimenez/920f034f539dab9681efb7fba36297d3 to your computer and use it in GitHub Desktop.
Save rmgimenez/920f034f539dab9681efb7fba36297d3 to your computer and use it in GitHub Desktop.
// Colocar no using
// using System.Net.Mail;
SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
var mail = new MailMessage();
mail.From = new MailAddress("email_remetente@hotmail.com");
mail.To.Add("email_destino@gmail.com");
mail.Subject = "Test Mail - 1";
mail.IsBodyHtml = true;
string htmlBody;
htmlBody = "Write some HTML code here";
mail.Body = htmlBody;
SmtpServer.Port = 587;
SmtpServer.UseDefaultCredentials = false;
SmtpServer.Credentials = new System.Net.NetworkCredential("email_remetente@hotmail.com", "senha");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment