No warning in log when mail server is not responding

thumbnail
Fernando Fernandez, modified 1 Year ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts

Hi all

We've had some complaints from a customer saying that emails being sent through Liferay MailServiceUtil are not getting to their destinations. We thought this was a problem with their mail relay server, because we have no messages logged about any connection problems.

Still we did some more tests and we found out that Liferay currently doesn't log anything if the mail server is not responding. We had to dig deep to find out that the MailEngine logging is turned off. 

We have found a workaround for this, by creating a tomcat\webapps\ROOT\WEB-INF\classes\META-INF\portal-log4j-ext.xml with the following content:

<Configuration strict="true">
    <Loggers>
        <Logger level="INFO" name="com.liferay.mail.internal"/>
        <Root level="INFO">
        </Root>
    </Loggers>
</Configuration>

 

After this, we started getting this message in the logfile:

2024-08-05 16:19:05.573 WARN  [liferay/mail-2][MailEngine:437] Unable to connect to a valid mail server. Please make sure one is properly configured: Couldn't connect to host, port: localhost, 25; timeout -1

 

Anyway, I think it would be better to enable it again, because this is a bit hard to detect if a server goes down and messages are lost.

HTH

Fernando