Const cdoAnonymous = 0 ' Do not authenticate
Const cdoBasic = 1 ' Basic (clear-text) authentication
Const cdoNTLM = 2 ' NTLM
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Simple plain text CDO example"
objMessage.From = """My name"" "
objMessage.To = "[email protected]"
objMessage.TextBody = "This is a test (sent using SMTP authentication)"
' Configure the send to use another server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
' Set the name or IP of the remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.myisp.com"
' Set the type of authentication to use, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
' Set your UserID on the SMTP server (some SMTP servers require your e-mail address)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "userid"
' Set your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
' Set the server port (usually 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
' Set if the connection should use SSL (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
' Set the connection timeout in seconds
' (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' Save the new configuration settings
objMessage.Configuration.Fields.Update
objMessage.Send
** Courtesy Of: http://www.pa-software.com/scripts/?tp=vbs&sc=cdoemail
|