Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- MailMessage mail = new MailMessage();
- SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
- mail.From = new MailAddress("sachinsnimbalkar@gmail.com");
- mail.To.Add("vaibhavlokhande55@gmail.com");
- mail.Subject = "Test Mail from sachin nimbalkar";
- mail.Body = "This is for testing SMTP mail from GMAIL";
- SmtpServer.Port = 587;
- SmtpServer.Credentials = new System.Net.NetworkCredential("sachinsnimbalkar@gmail.com", "YourPassword");
- SmtpServer.EnableSsl = true;
- SmtpServer.Send(mail);
- Button1.Text ="mail Send";
- }
- catch (Exception ex)
- {
- Button1.Text=ex.ToString();
- }
- }
Add Comment
Please, Sign In to add comment