Issue
-
The email notifications are not sent successfully when configured with smtp.office365.com. The below errors are observed while mail is being sent.
1) 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM] com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM]"
2)ERROR [liferay/mail-1][MailEngine:74] Unable to send message: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message.
0.35250:CF050000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:D01F0000, 1.36674:0E000000, 1.61250:00000000, 1.45378:D51F0000, 1.44866:22010000, 16.55847:E10F000
Environment
- Liferay DXP 7.1 and DXP 7.2
Resolution
-
For Liferay DXP 7.1
- The observed behavior is a known issue and is fixed in fixpack dxp-18.
- Installing Fix Packs and Hotfixes on Liferay DXP will guide you to install the Fixpack in your environment.
-
Please note that after the fix is installed, some manual configuration steps will be necessary for the solution to make it work.
-
Setting mail.session.mail.smtp.starttls.enable=true is no longer necessary, it is enabled by default. It can be changed in Control Panel -> Configurations -> Server Administration -> Mail
-
Office 365 has a limit for simultaneous connections
https://stackoverflow.com/questions/56088272/432-4-3-2-storedrv-clientsubmit-sender-thread-limit-exceeded
https://docs.microsoft.com/en-us/exchange/troubleshoot/send-emails/smtp-submission-improvementsLiferay uses the liferay/mail destination, which is a ParallelDestination. To adapt to this, the parallel destination should be configured to have just 1 thread (via workersCoreSize and workersMaxSize non-constructor args in mail-spring.xml), which will limit the number of simultaneous connections to Office 365. This can be done by ext-spring.xml in ROOT/WEB-INF/classes/META-INF. Please copy ext-spring.xml
to ROOT/WEB-INF/classes/META-INF and restart the server.
-
-
For Liferay DXP 7.2
- The observed behavior is fixed in fixpack dxp-5.
Additional Information
-
Highly recommended to do the followings before installing the Fix pack:
- Keep the backup of your existing environment before installing the fix pack.
- Try the above activity in a "lower environment first", if all works well according to you, then move to the production environment as per your discretion.
- Perform these operations in application server downtime, because these steps require the restart of the server.
- How to configure/use outlook mail server to send email notification in Liferay will help you to configure office365 in Liferay