Use C # to send an email [reference the Microsoft China Community]

Source: Internet
Author: User

Try
{
CDO. messageclass omsg = new CDO. messageclass ();
Omsg. From = "xxx@163.com"; // your email
Omsg. To = "xxx@163.com"; // receive email
Omsg. Subject = "mail test .";
Omsg. htmlbody = "<HTML> <body> mail test. </body> CDO. iconfiguration iconfig = omsg. configuration;
ADODB. Fields ofields = iconfig. fields;
Ofields ["http://schemas.microsoft.com/cdo/configuration/sendusing"]. value = 2;
Ofields ["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"]. value = "xxx@163.com ";
Ofields ["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"]. value = "zhgroup.ltd@163.com"; ["http://schemas.microsoft.com/cdo/configuration/sendusername"]. value = "zhgroup. Ltd ";
Ofields ["http://schemas.microsoft.com/cdo/configuration/sendpassword"]. value = "XXX"; // verify the account name
Ofields ["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]. value = 1; // verification level, 2
Ofields ["http://schemas.microsoft.com/cdo/configuration/languagecode"]. value = 0x0804;
Ofields ["http://schemas.microsoft.com/cdo/configuration/smtpserver"]. value = "smtp.163.com"; // SMTP Server
Ofields. Update ();
Omsg. bodypart. charset = "gb2312 ";
Omsg. htmlbodypart. charset = "gb2312 ";
Omsg. Send ();
Omsg = NULL;
}
Catch (exception ER)
{

...

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.