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?
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>
Use the SmtpClient and the MailMessage classes.
精彩评论