[language =c#]
System.Net.Mail.MailMessage myMail = new System.Net.Mail.MailMessage();
myMail.To.Add("someemailid.com");
myMail.From = new MailAddress("someemailid@someemailid.com", "someemailid ", System.Text.Encoding.UTF8);
myMail.Subject = "user Information";
myMail.SubjectEncoding = System.Text.Encoding.UTF8;
SmtpClient client = new SmtpClient();
client.Host = "localhost";
client.Port = 25;
client.Send(myMail);
The above code i have used in asp.net page
Its showing client.Send(myMail) failed
//////////////////
the below code i have used in web.config file
<system.net>
<mailSettings>
<smtp from="customercare@mailaddress.com">
<network host="smtp.mail.mailaddress.com" port="25" userName="something" password="pass" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>[/language]