DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Mandar Mail Con ASP.NET 2.0

01.30.2006
| 4713 views |
  • submit to reddit
        C#
MailMessage message = new MailMessage();
message.From = new MailAddress("remitente@lo.que.sea");
message.To.Add(new MailAddress("destinatario@lo.que.sea"));
message.Subject = "Asunto";
message.Body = "Cuerpo";
SmtpClient client = new SmtpClient();
client.Send(message);

web.config
<system.net>
    <mailSettings>
        <smtp from="email@algo.com">
            <network host="localhost" port="25" defaultCredentials="true" />
        </smtp>
    </mailSettings>
</system.net>