3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
259 stars 143 forks source link

[Bug]: Lizmap 3.6.0 unable to send emails via SMTP - mailer.cmdline.php doesn't exists #3368

Closed u-cav closed 1 year ago

u-cav commented 1 year ago

What is the bug?

I configured the mailer parameters in localconfig.ini.php as following (addresses and password hidden):

[mailer]
webmasterEmail="****@*****.**"
webmasterName="******"

mailerType=smtp
hostname="*****.**"
sendmailPath="/usr/sbin/sendmail"

smtpHost="*****.**"
smtpPort=587
smtpSecure="tls"
smtpAuth=on
smtpUsername="****@*****.**"
smtpPassword="************"
smtpTimeout=20

I then test the config with:

php lizmap/scripts/script.php jelix~mailer:test ****@*****.**

With Lizmap 3.5.8 and older, this setup was working as intended. With Lizmap 3.6.0 Lizmap fails to send emails, and throws this error:

Action mailer:test: controller file /var/www/lizmap-web-client-3.6.0/lizmap/vendor/jelix/jelix/lib/jelix/core-modules/jelix/controllers/mailer.cmdline.php doesn't exists /var/www/lizmap-web-client-3.6.0/lizmap/vendor/jelix/jelix/lib/jelix/core/jCoordinator.class.php 307

The same issue is present in lizmap/var/log/errors.log when an email send is triggered from the Lizmap web interface.

I tested this both with the official Docker containers, and with a traditional install.

With the traditional install, I have an older version in a different folder that is working correctly.

Am I missing some changes?

Thank you very much.

Steps to reproduce the issue

  1. Install Lizmap 3.6.0
  2. Configure the mailer in localconfig.ini.php (or profiles.ini.php), as documented in https://docs.jelix.org/en/manual/class-utilities/jmailer
  3. Test the config with php lizmap/scripts/script.php jelix~mailer:test ****@*****.**, or just send an email from Lizmap by creating a new user or resetting a password

Versions

Versions :

Check Lizmap plugin

QGIS server version, only if the section above doesn't mention the QGIS Server version

No response

Operating system

Debian 11

Browsers

Firefox, Chrome

Browsers version

Firefox 107, Chromium 108

Relevant log output

No response

nworr commented 1 year ago

Since lizmap 3.6, the mailer test command has moved Can you test using php lizmap/console.php mailer:test ?

In addition using, when using SMTP , you may need to create a SMTP profile in profiles.ini.php: https://docs.jelix.org/en/manual/class-utilities/jmailer#smtp-configuration-options

u-cav commented 1 year ago

@nworr Thank you very much for your feedback.

I can confirm that setting the SMTP parameters in profiles.ini.php, and referring to those in localconfig.ini.php works.

If I understand correctly, since jelix 1.8 it is not possible to configure the SMTP parameters directly in localconfig.ini.php, is that correct? I'm not finding a clear answer in the docs.

Thank you also for the updated mailer test command.

Are these changes documented somewhere, so that I can check them in the future instead of bothering you?

nworr commented 1 year ago

@u-cav , yes the jelix docs :

If you choose to send mail with a specific SMTP server, you should indicate how to connect to it by creating a profile into var/config/profiles.ini.php. The profile

But it's : "you must indicate how to connect to [..] creating a profile into ..."

u-cav commented 1 year ago

@nworr

Thank you very much for the feedback.

The next sentence in the jelix docs is:

You can still configure the SMTP parameters like in Jelix 1.6, although it is a deprecated way : do not create a profile, do not set smtpProfile, and add these parameters into the [mailer] section

In the jelix 1.8 docs that section was removed, and I'm finding:

jMailer options shall be edited in var/config/localconfig.ini.php, in a [mailer] section.

and then goes on to describe the various parameters that are used in the deprecated config (smtpHost instead of host, etc).

And afterwards:

Starting Jelix 1.6.17, you can set these parameters into a profile, which is better than into the main configuration.

Does this mean "the old setup is not supported anymore"?

Am I missing something? I want to understand if this breaking change was specified somewhere.