Use CDO to send mail through an external mail server (without installing other mail components)
Source: Internet
Author: User
Use CDO to send mail through an external mail server (without installing other mail components)
John Peterson [Hooke compilation]
CDO or CDONTS under Win2K are configured by default to send mail only through the local Microsoft SMTP service, and if you want to use an external mail server, you typically install a third-party component. The following code teaches you how to use CDO to send mail through an external mail server. (The translator Win2000 the test pass.) )
<%
Const cdosendusingmethod= "Http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdosendusingport=2
Const cdosmtpserver= "Http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdosmtpserverport= "Http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdosmtpconnectiontimeout= "Http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdosmtpauthenticate= "Http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdobasic=1
Const cdosendusername= "Http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdosendpassword= "Http://schemas.microsoft.com/cdo/configuration/sendpassword"
Dim objconfig ' as CDO. Configuration
Dim objmessage ' as CDO. Message
Dim Fields ' as ADODB. Fields
Set objconfig = Server.CreateObject ("CDO.") Configuration ")
Set Fields = Objconfig.fields
With Fields
. Item (Cdosendusingmethod) = cdoSendUsingPort
. Item (Cdosmtpserver) = "sony.com" changed to available external mail server domain name
. Item (cdosmtpserverport) = 25
. Item (cdosmtpconnectiontimeout) = 10
. Item (cdosmtpauthenticate) = Cdobasic
. Item (cdosendusername) = user name of server above "Hooke"
. Item (Cdosendpassword) = "MyPassword" password
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.