protected void SendMail() { var fromAddress = YourEmail.Text.ToString(); var toAddress = "abc@yahoo.ca";// Email Address from where you send the mail const string fromPassword = "12345678";//Password of your email address string subject = YourSubject.Text.ToString(); string body = "From: " + YourName.Text + "\n"; body += "Email: " + YourEmail.Text + "\n"; body += "Subject: " + YourSubject.Text + "\n"; body += "Question: \n" + Comments.Text + "\n"; var smtp = new System.Net.Mail.SmtpClient(); { smtp.Host = "smtp.mail.yahoo.ca"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential(fromAddress, fromPassword); smtp.Timeout = 20000; } smtp.Send(fromAddress, toAddress, subject, body); } protected void Button1_Click(object sender, EventArgs e) { try { SendMail(); lblMsgSend.Text = "Your Comments after sending the mail"; lblMsgSend.Visible = true; YourSubject.Text = ""; YourEmail.Text = ""; YourName.Text = ""; Comments.Text = ""; } catch (Exception) { } }
SmtpServer.Host = "smtp.mail.yahoo.com";
SmtpServer.Host = "smtp.mail.yahoo.com"; Or SmtpServer.Host = " plus.smtp.mail.yahoo.com"; smtp.Port = 465; smtp.EnableSsl = true;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)