Monday, May 12, 2008

Sending mail in

System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.From=new MailAddress("");
mail.To.Add(new MailAddress(""));//enter company name which send
mail.Subject = "Sending Enquiry";
mail.Body = "Enquiry About Company ";
//Proper Authentication Details need to be passed when sending email from gmail
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential("", "password");
//Smtp Mail server of Gmail is "" and it uses port no. 587
//For different server like yahoo this details changes and you can
//get it from respective server.
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("",587);
//Enable SSL
mailClient.EnableSsl = true;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
Response.Write("message was sent successfully!!!");


1 comment :

  1. Hi
    Can you give us the code for 1.1 how to
    authenticate email details.


AJAX, asp,, and sql server security, IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath