Anda di halaman 1dari 4

31/7/2015

HowtosendHTMLformattedmailusingCDOforWindows2000andaremoteSMTPservice

Question about Windows 10 upgrade or timing? Learn More

Support

How to send HTML formatted mail using


CDO for Windows 2000 and a remote SMTP
service
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore,
this article is offered "as is" and will no longer be updated.

Summary
This article describes how to send HTML formatted mail using CDO for Windows 2000 CDOSYS
or CDO for Exchange 2000 CDOEX using a remote computer's SMTP service.

More information
1. Create a file called Cdosmtp.vbs and paste the following code:

'Sendbyconnectingtoport25oftheSMTPserver.
DimiMsg
DimiConf
DimFlds
https://support.microsoft.com/enus/kb/286431

1/4

31/7/2015

HowtosendHTMLformattedmailusingCDOforWindows2000andaremoteSMTPservice

DimstrHTML
ConstcdoSendUsingPort=2
setiMsg=CreateObject("CDO.Message")
setiConf=CreateObject("CDO.Configuration")
SetFlds=iConf.Fields
'SettheCDOSYSconfigurationfieldstouseport25ontheSMTPse
rver.
WithFlds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusin
g")=cdoSendUsingPort
'ToDo:EnternameorIPaddressofremoteSMTPserver.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserve
r")="<remoteSMTPserver>"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconne
ctiontimeout")=10
.Update
EndWith
'BuildHTMLformessagebody.
strHTML="<HTML>"
strHTML=strHTML&"<HEAD>"
strHTML=strHTML&"<BODY>"
strHTML=strHTML&"<b>ThisisthetestHTMLmessagebody</b></b
r>"
strHTML=strHTML&"</BODY>"
strHTML=strHTML&"</HTML>"
'Applythesettingstothemessage.
WithiMsg
Set.Configuration=iConf
.To="<emailaddress>"'ToDo:Enteravalidemailaddress.
.From="<emailaddress>"'ToDo:Enteravalidemailaddress.
.Subject="ThisisatestCDOSYSmessage(SentviaPort25)"
.HTMLBody=strHTML
.Send
EndWith
'Cleanupvariables.
SetiMsg=Nothing
SetiConf=Nothing
SetFlds=Nothing
MsgBox"MailSent!"

https://support.microsoft.com/enus/kb/286431

2/4

31/7/2015

HowtosendHTMLformattedmailusingCDOforWindows2000andaremoteSMTPservice

2. Edit the sections of the code that are marked "ToDo".


3. Save the file, and then doubleclick it.
The code creates an HTMLformatted message and sends it using the remote computer's
SMTP service.

References
For additional information, click the article number below to view the article in the Microsoft
Knowledge Base:
286430 How To Send HTML Formatted mail Using CDO for Windows 2000 and the Local
Pickup Directory

Properties
Article ID: 286431 Last Review: 06/19/2014 12:38:00 Revision: 4.0
Keywords:
kbhowto KB286431

Support

Security

Contact Us

https://support.microsoft.com/enus/kb/286431

3/4

31/7/2015

HowtosendHTMLformattedmailusingCDOforWindows2000andaremoteSMTPservice

English United States

Terms of use

Privacy & cookies

https://support.microsoft.com/enus/kb/286431

Trademarks

2015 Microsoft

4/4

Anda mungkin juga menyukai