Advertisement
Guest User

tute

a guest
Jun 25th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3. using System.Net.Mail;
  4.  
  5. public class Program
  6. {
  7. public static void Main()
  8. {
  9. System.Windows.Forms.MessageBox.Show("test");
  10. try
  11.             {
  12.                 MailMessage mail = new MailMessage();
  13.                 SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
  14.  
  15.                 mail.From = new MailAddress("adview.plustek@gmail.com");
  16.                 mail.To.Add("adview.plustek@gmail.com");
  17.                 mail.Subject = "Test Mail";
  18.                 mail.Body = "This is for testing SMTP mail from GMAIL, you have passed the test.";
  19.  
  20.                 SmtpServer.Port = 587;
  21.                 SmtpServer.Credentials = new System.Net.NetworkCredential("adview.plustek", "sdewqazxcdoc");
  22.                 SmtpServer.EnableSsl = true;
  23.  
  24.                 SmtpServer.Send(mail);
  25.                 MessageBox.Show("mail Send");
  26.             }
  27.             catch (Exception ex)
  28.             {
  29.                 MessageBox.Show(ex.ToString());
  30.             }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement