Advertisement
Guest User

Untitled

a guest
Jul 6th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. How do I send email from C# without revealing my password?
  2. MailMessage mail = new MailMessage();
  3. SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
  4.  
  5. mail.From = new MailAddress("Contact@pandorafreed.com");
  6. mail.To.Add("myemail@gmail.com");
  7. mail.Subject = "Pandora Free-D Message";
  8. mail.Body = "Name: " + C.NameBox.Text + "n" + "Email: " + C.emailBox.Text + "n" + C.Message.Text;
  9.  
  10. SmtpServer.Port = 587;
  11. SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
  12. SmtpServer.EnableSsl = true;
  13.  
  14. SmtpServer.Send(mail);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement