shivkumar patil

shivkumar patil

  • NA
  • 23
  • 17.7k

How to Send An E-Mail from ASP.NET Web Application...?

Mar 19 2018 2:35 AM
I'm Using www.zoho.com email service bt my web apllication  not send email ,
using SmtpMail.Port = 465/25/587;(Port for sending the mail)
 
try
{
MailMessage message = new MailMessage();
message.To.Add(txtforgot.Text);// Email-ID of Receiver
message.Subject = "Voice Scatter Login Details";// Subject of Email
message.From = new System.Net.Mail.MailAddress(email_from);// Email-ID of Sender
message.IsBodyHtml = true;
message.AlternateViews.Add(Mail_Body());
SmtpClient SmtpMail = new SmtpClient();
SmtpMail.Host = "smtp.zoho.com";//name or IP-Address of Host used for SMTP transactions
SmtpMail.Port = 465;//Port for sending the mail
SmtpMail.Credentials = new System.Net.NetworkCredential(email_from, email_pwd);//username/password of network, if apply
SmtpMail.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpMail.EnableSsl = true;
SmtpMail.ServicePoint.MaxIdleTime = 0;
SmtpMail.ServicePoint.SetTcpKeepAlive(true, 2000, 2000);
message.BodyEncoding = Encoding.Default;
message.Priority = MailPriority.High;
SmtpMail.Send(message); //Smtpclient to send the mail message
Response.Write("<script LANGUEGE='Javascript'>alert(' Password Send on Registed Email Id')</script>");
}
catch (Exception ex)
{ Response.Write("Failed"); }
 
plz help me

Attachment: tst.zip

Answers (2)