HOME

Thursday, February 23, 2012

Send Mail to Internal Microsoft Office Outlook mail from C# Asp.Net



  public void SendMail(string From,string TO,string Subj,string msg)
    {

     
        string strFrom = From, strTo = TO, strSubject = Subj, strMsg = msg;


        // Create the mail message
        MailMessage objMailMsg = new MailMessage(strFrom, strTo);

        //objMailMsg.BodyEncoding  Encoding.UTF8;
        objMailMsg.Subject = strSubject;
        objMailMsg.Body = strMsg;
        objMailMsg.Priority = MailPriority.High;
        objMailMsg.IsBodyHtml = true;

        //prepare to send mail via SMTP transport
        SmtpClient objSMTPClient = new SmtpClient();
        objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
        objSMTPClient.Send(objMailMsg);

    }

No comments:

Post a Comment