Advertisement
Gov_777

Отправить email

Jun 4th, 2017
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System.Web; using System.Net; using System.Net.Mail;
  2. using System.Net.Mime;
  3. SmtpClient Smtp = new SmtpClient("smtp.gmail.com", 587); // 587 это порт
  4. Smtp.Credentials = new NetworkCredential("login", "password");
  5.  //Формирование письма
  6. MailMessage Message = new MailMessage();
  7. Message.From = new MailAddress("from@ok.com"); //от кого
  8. Message.To.Add(new MailAddress("to@ok.com")); // кому
  9. Message.Subject = "Заголовок"; Message.Body = "Сообщение"; Smtp.Send(Message);//отправка
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement