Sending mail

Posted by Shoyebaziz123 under ASP.NET on 9/7/2009 | Views : 1406 | Status : [Member] | Replies : 3
Hi Friends ,
can anybody give me a code for sending mail.




Responses

Posted by: Rtpharry on: 9/7/2009 [Member] [MVP] Bronze

Up
0
Down
Sure,

If you are using asp.net 2.0 or above then this is your one stop site for an introduction to the subject:

http://www.systemnetmail.com/

Check out any of the quickstarts here - whichever suits your needs:

http://www.systemnetmail.com/faq/3.aspx

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 9/7/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
This is how its Done

private void Send_EMailAddress(String To, String body,String Subject, String Attachments)
{

MailMessage mm = new MailMessage();

SmtpClient smtp = new SmtpClient();

mm.From = new MailAddress("vuyiswamb@gmail.com");

mm.To.Add(new MailAddress(To));

mm.Subject = Subject;

mm.Body = body;

mm.Attachments.Add(new Attachment(Attachments));

mm.IsBodyHtml = true;

smtp.Host = "smtp.gmail.com";

smtp.EnableSsl = true;

System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();

NetworkCred.UserName = "vuyiswamb@gmail.com";

NetworkCred.Password = "wow";

smtp.UseDefaultCredentials = true;

smtp.Credentials = NetworkCred;

smtp.Port = 587;

smtp.Send(mm);
}


Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakhangarg on: 9/7/2009 [Member] [Moderator] Silver

Up
0
Down
HI-

Visit this Link:http://lakhangarg.blogspot.com/2009/04/function-to-send-email-aspnet-c.html
to get the code to send email.

Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com/

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response