cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 5.1 Configure Outbound email with Office 365

rmeske
Confirmed Champ
Confirmed Champ
Hello,

I have reviewed a variety of posts regarding configuring Outbound mail to use Office 365. One implied it can't be done, and another a user was able to get it working, however I have tried the settings and am getting an error.

My settings alfresco-global.properties:
mail.host=smtp.office365.com
mail.port=587
mail.protocol=smtps
mail.from.default=test@mydomain.com
mail.username=test@mydomain.com
mail.password=mypassword
mail.encoding=UTF-8
mail.smtps.starttls.enable=true
mail.smtps.auth=true

I can telnet to smtp.office365.com 587 successfully, so I know the port is not blocked.

The error in the alfresco log is:
2016-05-03 12:18:37,864 ERROR [org.alfresco.repo.action.executer.MailActionExecuter] [ajp-apr-8009-exec-5] Failed to send email to someuser@mydomain.com : org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.office365.com, port: 587;
  nested exception is:
        javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: smtp.office365.com, port: 587;
  nested exception is:
        javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?; message exceptions (1) are:
Failed message 1: javax.mail.MessagingException: Could not connect to SMTP host: smtp.office365.com, port: 587;
  nested exception is:
        javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

What else can I look at?

Regards,
Ron
3 REPLIES 3

rmeske
Confirmed Champ
Confirmed Champ
Hello,

I have found the correct settings to use with Office 365 email and am documenting them here for others.

The issues with my previous settings was the smtps.  Office 365 email uses TLS, not SSL.  This required changing all smtps settings to smtp.  It also does not allow mail forwarding so I need to add one more setting: mail.fromm.enabled=false.

My settings in alfresco-global.properties that now work:
mail.host=smtp.office365.com
mail.port=587
mail.protocol=smtp
mail.from.default=test@mydomain.com
mail.username=test@mydomain.com
mail.password=mypassword
mail.encoding=UTF-8
mail.smtp.starttls.enable=true
mail.smtp.auth=true
mail.from.enabled=false

Regards,
Ron

hudaz2410
Champ in-the-making
Champ in-the-making

Hi rmeske _​​

I am grateful for your entry, since I am having this problem too.

I am new to alfresco and I have been searching and trying almost everything, and now I feel obliged to thank you for posting the update on your findings Smiley Happy

Thank You

travisr
Champ in-the-making
Champ in-the-making

The downside of using "mail.from.enabled=false" is that all notifications appear to come from the same address, so that any inter-user mailings won't show who it was that initiated the event in the From field of the email.

If all of your Alfresco users have email addresses under your Office 365 account then you can give your dedicated SMTP account SendAs permissions on everybody else's account with a single Office 365 PowerShell command:

Get-Recipients | Add-RecipientPermission -AccessRights SendAs -Trustee <smtp user>

Where <smtp user> is the identity of the account that is also used for SMTP authentication. You could also separately run the Add-RecipientPermission command on individual accounts that map to the emails of Alfresco users. With this in place, you can then set "mail.from.enabled=true" in alfresco-global.properties and the From field on notifications will now show the initiator's address. The caveat is that this only works if the initiator has an Office 365 account on which the Add-RecipientPermission command has been executed. That may not be practical if you have Alfresco users without Office 365 accounts in your domain.

I think there is a more robust option which would allow any address in the From field, by way of an SMTP relay according to Option 3 at How to set up a multifunction device or application to send email using Office 365 - Office 365, but I haven't tried that yet because the SendAs method is currently sufficient for our usage.