Use CDO. Message in ASP to send emails requiring authentication

Source: Internet
Author: User
Set objmail = server. Createobject ("CDO. Message ")
Set objconfig = server. Createobject ("CDO. Configuration ")
Objconfig. Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Objconfig. Fields ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Objconfig. Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.com"
Objconfig. Fields ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Objconfig. Fields ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
Objconfig. Fields ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
Objconfig. Fields ("http://schemas.microsoft.com/cdo/configuration/languagecode") = "0x0804"
Objconfig. Fields. Update ()
Set objmail. Configuration = objconfig
Objmail. Subject = "mail subject"
Objmail. From = CHR (34) & "name" & CHR (34) & "username@mail.com "
Objmail. To = "gbhglxs@customs.gov.cn"
Objmail. htmlbody = "mail body"
Objmail. addattachment (http: // xxxxxx/xxxx. XXX) 'or any other correct URL, including HTTP, FTP, and file.
Objmail. Send
Response. Write "email sent successfully! "
It is worth noting that sendusername must be consistent with from.
Related Article

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.