We love Office 365, specifically the Exchange/Outlook email features such as calendar sharing, etc. But when we switched to it most of our automated email applications and scripts failed as the SMTP (and POP) configurations are different.
So here are my findings on the subject in the hope that it can help some people.
1. Obtain SMTP Configuration Parameters
First get the parameters of your Office 365 account by going to Office 365 live (https://portal.microsoftonline.com/) login and access Outlook
Then access the Options menu – See All Options
Now click on the hyperlink marked “Settings for POP, IMAP, and SMTP access…”
and you will get a window with the server and port settings. Something like:
Server name: podxxxxx.outlook.com
Encryption method: TLS
2. External Applications
If you are using applications that have their own emailing engine such as Final Builder, Telerik Test Studio, TFS, etc.
Most likely you will be able to fill in the above information easily something like:
Its important to notice that we need to Authenticate and use SSL and enter our user credentials
Sending email using CDO.Message is (for reasons unknown to me slightly different). I use VB Script from a Windows 2008 server as follows:
Dim objCDO Set objCDO = CreateObject("CDO.Message") objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "podxxxxx.outlook.com" objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "firstname.lastname@example.org" objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true objCDO.Configuration.Fields.Update ' Rest of sending code goes here...
Please note here that the port is not 587 but 25. Do not understand why this works but it does. If you can explain it please let me know.