Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MailMessage mail = new MailMessage();
- mail.From = new MailAddress("from@gmail.com", "fromName");
- mail.To.Add(new MailAddress("to@gmail.com", "toName");
- mail.Subject = "Example Mail Subject";
- mail.Body = "Hello,\n\n" + "Example Body Texting\n\n" + "Have a nice day!";
- SmtpClient smtp = new SmtpClient();
- smtp.Host = "mail.server.com";
- smtp.Port = 587;
- smtp.UseDefaultCredentials = false;
- var credential = new NetworkCredential
- {
- UserName = "mail user name",
- Password = "mail user password"
- };
- smtp.Credentials = credential;
- smtp.EnableSsl = false;
- smtp.Send(mail);
Add Comment
Please, Sign In to add comment