Tuesday, June 9, 2009

Sending mails in asp.net

use this name space using System.Web.Mail;


public static void MailMessage(string body, string subject, string fromMailID, string toMailID)
{

MailMessage msgMail = new MailMessage();
msgMail.Priority = MailPriority.High;
msgMail.BodyFormat = MailFormat.Html;
msgMail.Subject = subject;
msgMail.To = toMailID;
msgMail.Body = body;
msgMail.From = fromMailID;
SmtpMail.Send(msgMail);

}




send Multiple Mail ::

public static void SendMail(string body, string subject, string fromMailID, string toMailID, string bcc)
{

MailMessage msgMail = new MailMessage();
msgMail.Priority = MailPriority.High;
msgMail.BodyFormat = MailFormat.Html;
msgMail.Subject = subject;
msgMail.To = toMailID;
msgMail.Body = body;
msgMail.From = fromMailID;
msgMail.Bcc = bcc;
SmtpMail.Send(msgMail);

}

No comments:

Popular Posts