I just wanted to summarize the essence and show some code on how to send email from Azure code via Exchange Online web services if you have an Exchange Online email subscription.
Turns out I was able to register a nice domain for my Exchange Online trial: windowsazure.emea.microsoftonline.com
var service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.Url = new Uri( "https://red002.mail.emea.microsoftonline.com/ews/exchange.asmx"); service.Credentials = new WebCredentials(userName, password); var message = new EmailMessage(service); message.ToRecipients.Add("[email protected]"); message.From = new EmailAddress( "[email protected]"); message.Subject = "Hello EMail - from Windows Azure"; message.Body = new MessageBody(BodyType.HTML, "Email from da cloud :)"); message.SendAndSaveCopy();
In the code above I am sending the email via the EWS host for Europe – you may need different URLs for your location:
Asia Pacific (APAC): https://red003.mail.apac.microsoftonline.com
Europe, the Middle East, and Africa (EMEA): https://red002.mail.emea.microsoftonline.com
North America: https://red001.mail.microsoftonline.com
Hope this helps.