Hello All,
I have been looking over the internet for a long time now and couldn't find a solution.
I am using CDO for sending emails without outlook from VBA. It was working fine until I bought Office365 Subscription. This is what I am using:
'========================================================================
'Create the Microsoft CDO object
'========================================================================
'Initialize the CDO object
Set objMessage = CreateObject("CDO.Message")
'========================================================================
'Configure the CDO server settings
'========================================================================
'Set the CDO configuration settings
With objMessage.configuration.Fields
'CDO send type
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'SMTP server address
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = ""
'Server Port
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 ' tried 25, 465 etc
'SSL connection required (False or True)
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
'Authentication type (None, Basic (Base64 encoded), NTLM)
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2 ' tried everything here
'Username
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sFaxServer_Username
'Password
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sFaxServer_Password
'Connection timeout in seconds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
'Update the object configuration
.Update
End With
objMessage.Subject = "Subject"
objMessage.FROM = "Valid Office 365 Email ID"
objMessage.To = "Valid Email ID Here"
'objMessage.TextBody = "Body Text"
objMessage.htmlBody = "HTML Body Here"
It has started giving me Cannot Connect to Server Error. It is coming after I moved my email services to office 365.
My initial thought is, Office 365 SMTP Relay uses TLS Encryption, and CDO doesn't TLS Encryption. I saw every possible thread online but couldn't find the answer. If anyone has used Office 365 SMTP server with CDO, please share the feedback. It would be really helpful for me.
FYI, Outlook can send emails though, using TLS Ofcourse.
Thanks,
V
Bookmarks