2

Possible Duplicates:
ASP.NET- Sending an e-mail
how to send mail using C#?

How can I send emails from my ASP.NET web application?

Community
  • 1
  • 1
kiran826
  • 331
  • 1
  • 4
  • 10
  • 1
    ... How about give us some more information – Bas Apr 22 '10 at 13:51
  • This isn't really a question. You should provide more information and formulate a proper question. – Rune Grimstad Apr 22 '10 at 13:51
  • 1
    http://stackoverflow.com/questions/2354436/how-to-send-mail-using-c http://stackoverflow.com/questions/2467930/how-to-send-mail-in-asp-net http://stackoverflow.com/questions/767694/asp-net-sending-an-e-mail – Jørn Schou-Rode Apr 22 '10 at 13:53

2 Answers2

3

Use the SmtpClient and the MailMessage classes.

Rune Grimstad
  • 35,612
  • 10
  • 61
  • 76
3

Here is an example

MailMessage mailMessage = new MailMessage(new MailAddress("sender@email.com", "Sender Name"), new MailAddress("email@email.com"));
mailMessage.Subject = "Some subject";
mailMessage.Body = msg;
mailMessage.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient();
smtpClient.Send(mailMessage);

Setup configuration in web.config

 <system.net>
<mailSettings>
  <smtp>
    <network
         host="mail.email.com"
         port="587"
         userName="user@email.com"
         password="xxxx" />
  </smtp>
</mailSettings>

alejandrobog
  • 2,091
  • 14
  • 20