troubleshooting Question

SMTP Relay with Office 365 using Classic ASP

Avatar of brownmetals
brownmetals asked on
ASPMicrosoft 365
15 Comments1 Solution7099 ViewsLast Modified:
I am trying to send a CDO email message using Classic ASP (VBScript) and Office 365. I have tried everything I can think of in the documentation (http://community.office365.com/en-us/wikis/exchange/how-to-setup-an-smtp-relay-in-office-365.aspx), but I can't get this to work. Has anyone else had success with their SMTP relay setup using ASP/CDO?


      Set objMail=CreateObject("CDO.Message")
      Set iConf = CreateObject("CDO.Configuration")
      Set Flds = iConf.Fields
      With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"  'also tried mydomain-com.mail.protection.outlook.com
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587  'tried 25 and 587
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyOffice365Email@myDomain.com"      
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "myPassword"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1      'cdoBasic
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl ") = true            
            .Update
      End With      
With objMail
   Set .Configuration = iConf
   .From = empEmail
   .To = EmailAddress
   .BCC = empEmail
   .Subject = "My Subject Line Here"
   .HTMLBody = msgBody
   .Send
End With
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros