0

I am working with jWordPress that combines Quercus and JavaMail 1.4.1 with WordPress 4.2.2 in a WAR file executed under Tomcat on Windows. I am having trouble configuring outgoing email service: By default, Quercus attempts to contact an SMTP server on port 25 of localhost, which fails.

In the WAR file, Quercus is configured via WEB-INF/web.xml that, among other settings, has the following one (I uncommented it in the original file):

<init-param>
  <param-name>ini-file</param-name>
  <param-value>WEB-INF/php.ini</param-value>
</init-param>

I created a WEB-INF/php.ini file with the following settings for AWS SES, which work fine with JavaMail in a different app (note that this is an authenticated STARTTLS connection on port 587):

[PHP]
[mail function]
SMTP = <address of the AWS SES SMTP host>
smtp_port = 587
smtp_username = <AWS SES username>
smtp_password = <AWS SES password>
sendmail_from = <a 'no-reply' email address>

The names of the above parameters correspond to the ones found in the Quercus' MailModule:

https://github.com/moriyoshi/quercus-gae/blob/master/src/main/java/com/caucho/quercus/lib/MailModule.java

The WEB-INF/web.xml file appears to be processed at startup because if errors are introduced in it, they are reflected in the Tomcat log as well as in the WordPress operation. However, there is no indication in the log that the WEB-INF/php.ini is read or processed.

WordPress seems to be working fine. A simple test of the WP outgoing email is to click on "Log In" under Meta, then on "Lost your password?", enter the WP username and click on "Get New Password". This results in the following warnings in the Tomcat log:

10-Sep-2015 09:57:47.836 WARNING [http-nio-8080-exec-4] com.caucho.quercus.lib.mail.MailModule.mail Quercus[] mail could not send mail to '<user email address>'

Could not connect to SMTP host: localhost, port: 25

So, it looks like Quercus MailModule is not seeing settings from php.ini. How do I fix this?

P.S. Please do not suggest workaround solutions that require an installation of sendmail or alike on port 25 of localhost.

user1408140
  • 639
  • 3
  • 9
  • 20

1 Answers1

0

Well, it turned out that the php.ini file specified in

<init-param>
  <param-name>ini-file</param-name>
  <param-value>WEB-INF/php.ini</param-value>
</init-param>

must have an absolute path instead of just WEB-INF/php.ini, e.g.

C:/Program Files/Apache/Tomcat/.../WEB-INF/php.ini

(I experimented with multiple relative paths to no avail.) This solved the problem of the file not being read.

However, another problem emerged: the 'sendmail_from' setting in php.ini has no effect. Looking at the Quercus MailModule code at the link above, if there is a 'from' setting in additional headers, then it will be used and the 'sendmail_from' setting will not be used at all.

Wordpress appears to use a 'wordpress@localhost', regardless of the configured admin email address setting. When this address is used with a remote SMTP host, the email is either rejected (AWS SES) or accepted but silently dropped (Comcast). I will post this on SO as a separate problem.

user1408140
  • 639
  • 3
  • 9
  • 20