Saturday, May 30, 2009

Send a SMTP E-Mail

using System;
using System.Web.Mail;

namespace TestMail
{
public class SendMail
{
public void Send(string serverName, string to, string from, string subject)
{
SmtpMail.SmtpServer = serverName;

MailMessage m = new MailMessage();
m.To = to;
m.From = from;
m.Subject = subject;
m.Body = body;

SmtpMail.Send(m);
}
}
}

No comments:

Post a Comment