brownmetals
asked on
SMTP Relay with Office 365 using Classic ASP
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/exc hange/how- to-setup-a n-smtp-rel ay-in-offi ce-365.asp x), 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.Configur ation")
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.protecti on.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
Set objMail=CreateObject("CDO.
Set iConf = CreateObject("CDO.Configur
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.protecti
.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
.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
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your solution sounds valid. But without knowing the line number it's hard to tell.
There are a lot of variables with email.
There are a lot of variables with email.
Read through their info http://support.microsoft.com/kb/2600912
You may have to authorize on the ms site.
You may have to authorize on the ms site.
try change the auth to NTLM:
also try using SMTP server IP address instead of name
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
also try using SMTP server IP address instead of name
ASKER
The error sites the line that has the "SEND" command on it so it's happening at the point the email is trying to be sent using the Office 365 servers.
I've been using this info as well to try and get this to work:
http://community.office365.com/en-us/wikis/exchange/how-to-setup-an-smtp-relay-in-office-365.aspx
The middle column uses "mydomain-com.mail.protect ion.outloo k.com" to send via SMTP relay. I have not been able to get that to work. My cloud migration vendor has suggested that the best option is to use the 1st column using "smtp.office365.com" and Port 587 with TLS encryption. The only setting I can find that remotely resembles TLS encryption is the smtpUsesSSL attribute and set it to true. However, I'm not sure that the Classic ASP smtpUsesSSL setting is compatible with Microsoft's SSL/TLS to establish a connection.
For my copier to send scanned images via email, I was able to get it to work using the settings from the 1st column, but I haven't had such luck with Classic ASP applications. Any other suggestions?
I've been using this info as well to try and get this to work:
http://community.office365.com/en-us/wikis/exchange/how-to-setup-an-smtp-relay-in-office-365.aspx
The middle column uses "mydomain-com.mail.protect
For my copier to send scanned images via email, I was able to get it to work using the settings from the 1st column, but I haven't had such luck with Classic ASP applications. Any other suggestions?
ASKER
I've tried changing smtpauthenticate to a value of 2 and it produced the same error.
Microsoft changes the IP addresses of their email servers regularly, so using an IP address as opposed to the FQDN would not produce a reliable solution.
Thanks for the continued support. Further suggestions are certainly appreciated.
Microsoft changes the IP addresses of their email servers regularly, so using an IP address as opposed to the FQDN would not produce a reliable solution.
Thanks for the continued support. Further suggestions are certainly appreciated.
ASKER
I was able to eliminate the error message by using this configuration shown here:
http://www.saotn.org/the-sendusing-configuration-value-is-invalid/#smtp_auth_tls_asp
However, the email is still not coming through which makes me think that Office 365 servers are still blocking it for some reason. I am using a valid Office 365 user's email account as the FROM address, but for some reason, it still does not go through. Any other suggestions?
Thanks,
J
http://www.saotn.org/the-sendusing-configuration-value-is-invalid/#smtp_auth_tls_asp
However, the email is still not coming through which makes me think that Office 365 servers are still blocking it for some reason. I am using a valid Office 365 user's email account as the FROM address, but for some reason, it still does not go through. Any other suggestions?
Thanks,
J
Is it in your spam folder?
ASKER
I wish it were that easy. :-) No, not in the spam folder.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That is probably wise! What did you end up with?
ASKER
McAfee Saas Email Protection - easy to incorporate into Classic ASP code and all other devices like printers, servers, and copiers and all messages (inbound and outbound) are scanned for malware. It's a slam dunk! Thanks again for your suggestions.
ASKER
I found a better alternative than Office 365. Please see my comment above.
ASKER
error '8004020e'
My research tells me that this is most likely an authentication issue with Office 365 where the Office 365 servers are rejecting the attempt because I do not have permission to send through their servers. I'll continue to work on it, but let me know if you have any other suggestions.
Thanks!
J