I am attempting to deliver a email message when i run my webform page to my personal email server address at Yahoo named [email protected] using my visual studio developer connected to internet. I am unable to succesfully send a message?
protected void btnSendEmail_Click(object sender, EventArgs e)
{
try
{
MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
message.From = new MailAddress("[email protected]");
message.To.Add(new MailAddress("[email protected]"));
message.Subject = "Test";
message.IsBodyHtml = true; //to make message body as html
message.Body = "";
smtp.Port = 587;
smtp.Host = "smtp.mail.yahoo.com"; //for gmail host
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("[email protected]", "testbedemail");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);
}
catch (Exception) { }
}
Rijwan AnsariPosted Aug 19, 2021, 6:13 AM
Md SarfarajPosted Aug 19, 2021, 3:13 AM
peterPosted Aug 18, 2021, 7:45 PM
Jignesh KumarPosted Aug 15, 2021, 6:34 AM
peterPosted Aug 14, 2021, 6:58 PM
Leon DPosted Aug 2, 2021, 1:42 AM
peterPosted Aug 1, 2021, 7:27 PM
Sonil KumarPosted Jul 30, 2021, 12:10 PM
peterPosted Jul 27, 2021, 4:29 PM
Sachin SinghPosted Jul 26, 2021, 3:12 AM