Software Programs and Projects

This Software Programs and Projects include programing tips and technology using different languages like VC++,ASP,JSP C#.Net,PHP,VB.Net,JavaScript,ASP.NET .Software Programs and Projects blog mainly support to software programmers and provide help through the mail.

How can send the Email in the Asp.net?


try
{
string strPassword = string.Empty;
string strMailFrom = string.Empty;
string smtpServer = "ServerName";

SmtpClient smtp = new SmtpClient();
strMailFrom = "Email Id";
strPassword = "Password";
smtp.Host = smtpServer;
smtp.Port = 25;

//smtp.EnableSsl = true;
//check the Authentication
If(true)
{
smtp.UseDefaultCredentials = true;
smtp.Credentials = new System.Net.NetworkCredential(strMailFrom, strPassword);
}


MailMessage mail = new MailMessage();
mail.From = new MailAddress(strMailFrom);
mail.To.Add("EmailId");
mail.Bcc.Add("EmailId");
mail.Subject = m_strEmailSubject.ToString();
mail.Body = m_strEmailMessage.ToString();
smtp.Send(mail);


}
catch (Exception objException)
{
throw new Exception(objException.Message.ToString());

}


tag-:How can send the Email in the Asp.net?
Smtp,Email,SmtpClient

0 comments:

Post a Comment

Post a Comment