Thursday, 23 September 2010

Sending email in asp.net

 public void sendemail(string from, string to, string subject, string body)
    {
        try
        {
            MailMessage omsg = new MailMessage();
            omsg.From = new MailAddress(from);
            omsg.To.Add(to);
            omsg.Subject = subject;
            omsg.Body = body;
            omsg.Priority = MailPriority.High;
            omsg.IsBodyHtml = true;
            omsg.BodyEncoding = System.Text.Encoding.UTF8;

            SmtpClient smtp = new SmtpClient();
            smtp.Send(omsg);
        }
        catch (Exception ex)
        {
            //
        }
    }

   
      
     
       
     

   

   

No comments:

Post a Comment