Email from ASP.Net

Posted by Nisha03 under Regular Expressions on 1/11/2010 | Views : 1336 | Status : [Member] | Replies : 7
How can we send an email from ASP.Net using C#?




Responses

Posted by: Raja on: 1/11/2010 [Member] Starter

Up
0
Down
Hi Nisha,

Following link should help you.

http://www.dotnetfunda.com/articles/article7.aspx
http://www.dotnetfunda.com/forums/thread748-sending-mail.aspx

Thank you.

Regards,
Raja, USA

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

Posted by: Poster on: 1/11/2010 [Member] Starter

Up
0
Down
Hi Nisha,

If you want to send email using your gmail credential this post can help you.

http://www.dotnetfunda.com/articles/article747-how-to-send-an-email-using-gmail-in-aspnet-.aspx

From ASP.NET you can go through

http://aspalliance.com/149_How_to_Send_Email_from_ASP_NET_

http://www.aspheute.com/english/20000918.asp

Thanks


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

Posted by: Nishithraj on: 1/12/2010 [Member] Bronze

Up
0
Down
The basic code for sending mails using C# is as follows

MailMessage mail = new MailMessage();


mail.To = "testto@test.com";

mail.From = "testfrom@test.com";

mail.Subject = "Some text here";

mail.Body = "Some text here";

SmtpClient SmtpServer = "localhost";

SmtpMail.Send(mail);


You can replace the smtp server(some ip address) in place of localhost here.


Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

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

Posted by: Rcsprakash on: 1/12/2010 [Member] Starter

Up
0
Down
SmtpClient smtpClient = new SmtpClient("mailserver ip", portno);//port no normally 25
MailMessage mailMsg= new MailMessage()
MailAddress mailFrom=new MailAddress("fromaddress");
MailAddress mailTo=new MailAddress("toaddress");
mailMsg.To.Add(mailTo);
mailMsg.From = mailFrom;
mailMsg.Body ="your mail msg";
mailMsg.Subject = "mailSubject";
mailMsg.IsBodyHtml = true;// to support html tags
smtpClient.Send(mailMsg);

your mail server must enabled to support send and receiving of mail

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

Posted by: Rtpharry on: 1/12/2010 [Member] [MVP] Bronze

Up
0
Down
The best place to get all your asp.net mail questions answered in my opinion is:

http://www.systemnetmail.com/

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

Posted by: Bubbly on: 1/13/2010 [Member] Bronze

Up
0
Down
Hello,

Check this link

http://www.dotnetspider.com/resources/21608-Sending-Email-Through-ASP-NET-using-C.aspx

++
Thanks & Regards,
Deepika

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

Posted by: Puneet20884 on: 1/15/2010 [Member] Bronze

Up
0
Down
http://www.dotnetfunda.com/articles/article747-how-to-send-an-email-using-gmail-in-aspnet-.aspx

Best Regards,
Puneet Sharma - Infosys
Pune, India

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

Login to post response