i want to mail welcome message when a user register in my web site.
i use the below code but it does'nt work.
public static void Send(string mail_to)
{
MailMessage mailMsg = new MailMessage();
mailMsg .From = "info@mashhad915.com";
mailMsg .To =mail_to;
mailMsg .Subject = "Welcome!";
mailMsg .Body ="";
SmtpMail.SmtpServer="mail.mashhad915";
SmtpMail.Send(mailMsg );
}
please help me?
Send mail in c# code(asp.net 1.1)?
Don't forget the using statement. Assuming your SMTP server is configured correctly, the following should work.
using System.Web.Mail;
public static void Send(string mail_to)
{
MailMessage mailMsg = new MailMessage();
mailMsg.From = "info@mashhad915.com";
mailMsg.To = mail_to;
mailMsg.Subject = "Welcome!";
mailMsg.Body = "";
SmtpMail.SmtpServer = "mail.mashhad915";
SmtpMail.Send(mailMsg);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment