Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Office365 Smtp Thread Limit Exceeded Error
Hello ,
I have successfully setup office365 account to use for my notifications in liferay portal.
When i do send the notifications i get the following error though :
Is there any way to reduce the max threads java mail uses ? Or somehow overcome this error ?
I have successfully setup office365 account to use for my notifications in liferay portal.
When i do send the notifications i get the following error though :
Unable to send message: 432 4.3.2 STOREDRV.ClientSubmit; sender thread limit exceeded [Hostname=AM7P189MB0993.EURP189.PROD.OUTLOOK.COM]_ [Sanitized]
com.sun.mail.smtp.SMTPSendFailedException: 432 4.3.2 STOREDRV.ClientSubmit; sender thread limit exceeded [Hostname=AM7P189MB0993.EURP189.PROD.OUTLOOK.COM]_ [Sanitized]
Is there any way to reduce the max threads java mail uses ? Or somehow overcome this error ?
Hard to say. Are you actually sending so many mails at once/parallel? Maybe you could change the office 365 quota?
I am not sure this can be solved in Liferay at all. The problem is that multiple quotas, like max. 150 mails per hour can usually be configured in smtp servers. And tracking and managing those limits is not trivial.
I would probably solve this using a local smtp gateway (in my case postfix because I know it a bit). Liferay -> local smtp -> Office365 SMTP. While I am not postfix expert it should be possible to throttle it. It also automatically retries for a couple of days, so usually all mails should be sent. Of course, the queue might grow and grow, but in that case, a fix will never be possible since you are trying to send more mails than you are allowed too.
I am not sure this can be solved in Liferay at all. The problem is that multiple quotas, like max. 150 mails per hour can usually be configured in smtp servers. And tracking and managing those limits is not trivial.
I would probably solve this using a local smtp gateway (in my case postfix because I know it a bit). Liferay -> local smtp -> Office365 SMTP. While I am not postfix expert it should be possible to throttle it. It also automatically retries for a couple of days, so usually all mails should be sent. Of course, the queue might grow and grow, but in that case, a fix will never be possible since you are trying to send more mails than you are allowed too.
The Actual emails are 43 exactly as many as my Liferay users and error points to smtp threads and not emails per minute to be honest. I think if there is a way for me to limit smtp connections to 1 it will be ok. Can i somehow do this?
Kleanthis Savva:
You can try setting mail.session.jndi.name instead of the individual host/user/password settings and configure the Mail connection through your appserver - there you have all parameters available.
The Actual emails are 43 exactly as many as my Liferay users and error points to smtp threads and not emails per minute to be honest. I think if there is a way for me to limit smtp connections to 1 it will be ok. Can i somehow do this?
Olaf Kock:
Is there really a mail transport implementation that allows you to limit the number of threads/parallel message? Could be, but I never saw a parameter for that.Kleanthis Savva:You can try setting mail.session.jndi.name instead of the individual host/user/password settings and configure the Mail connection through your appserver - there you have all parameters available.
The Actual emails are 43 exactly as many as my Liferay users and error points to smtp threads and not emails per minute to be honest. I think if there is a way for me to limit smtp connections to 1 it will be ok. Can i somehow do this?
Christoph Rabel:
I can neither confirm nor deny. I just can state that if it is configurable, it would rather be there than in Liferay's properties.
Is there really a mail transport implementation that allows you to limit the number of threads/parallel message? Could be, but I never saw a parameter for that.
Sorry, I didn't check upfront if that is indeed a parameter. But if it isn't configurable here, this would be a strong indicator that the issue is elsewhere and concurrent threadcount is rarely limited.
I googled the error and it seems to be indeed very uncommon and it looks like a feature of Microsoft.
My best guess is that it isn't configurable at all in javax mail and therefore, it can't be fixed there (except by creating your own mail transport implementation which uses locking)
@OP: Maybe you can change/extend some Liferay class. When you enable debug logging for the Mail related packages like
com.liferay.petra.mail
com.liferay.mail.service
do you see a stacktrace? Maybe some of the classes there can be more or less easily replaced.
If you have a linux server I would set up postfix and route the mail traffic through the local server. That helped me several times before since postfix is very flexible. While it can be a bit overwhelming, just dispatching mails to another smtp server is not really hard to configure.
My best guess is that it isn't configurable at all in javax mail and therefore, it can't be fixed there (except by creating your own mail transport implementation which uses locking)
@OP: Maybe you can change/extend some Liferay class. When you enable debug logging for the Mail related packages like
com.liferay.petra.mail
com.liferay.mail.service
do you see a stacktrace? Maybe some of the classes there can be more or less easily replaced.
If you have a linux server I would set up postfix and route the mail traffic through the local server. That helped me several times before since postfix is very flexible. While it can be a bit overwhelming, just dispatching mails to another smtp server is not really hard to configure.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™