@netdesign opened this Issue on September 6th 2017

Googling my issue doesn't give any useful result so I submit this issue with attached the solution (as a screenshot). I hope it is useful.

The ISSUE in the suject is reproducible if:

1) You use an external SMTP server to send Email reports
2) Your external SMTP server requires fully-qualified-hostname EHLO/HELO from client to grant sending

The SMTP transport class included in the Piwik sources hardcodes the hostname to "localhost" instead of the true local hostname as required by RFC2821, RFC1869. This way the SMTP server refuses to send the report email.

The "Zend_Mail_Transport_Smtp" constructor provides a way to set custom configuration (such as the hostname) but the Piwik interface isn't able to set this variable.

Here I attach my solution :)


@Globulopolis commented on September 6th 2017 Contributor

SMTP server address in General settings is not it?

@netdesign commented on September 7th 2017

No, it isn't. The "SMTP server address" in "General settings" is the address of the SMTP server while the issue is related to the client (during smtp connection the client connects to the server, the server introduces itself and waits for the client to send its hostname, this kind of handshake is called HELO / EHLO).

You can get many details about the smtp connection steps and commands on http://www.samlogic.net/articles/smtp-commands-reference.htm

@Globulopolis commented on September 7th 2017 Contributor

@netdesign problem not in the core Zend_Mail_Transport_Smtp. I see that the Mail->initSmtpTransport() do not use host value at all.
Piwik config.ini file contain host for mail transport but this is not a client hostname.
Maybe I can do PR for this.

@netdesign commented on September 8th 2017

Dear @Globulopolis, add the "client hostname" support in the Piwik config.ini would be an option, but I'm sure that setting "localhost" as default value in "$this->_name" is a fault because "localhost" is meaningless in the SMTP protocol (every host is localhost).

Even if you add the discussed variable in the Piwik config.ini, what would be the default value? What would happen if the user doesn't set the variable and leaves the software to choose it for him? It most likely will be "localhost" and the probem is here again (except that Piwik forces the user to set the value during the installation).

What I'd suggest is to report the issue to the upstream Zend team and adding, as just you said, the variable to the Piwik config.ini.

This will give the freedom to advanced users to set the "client hostname" to a custom value but will set automatically the variable with a meaningful value (the real hostname as known by the OS).

I hope you share my personal opinion.
Have a nice day ;)

Fabio (team Netdesign)

@bglxx commented on September 8th 2018

Dear @Globulopolis, I dont want to change Zend files so I have changed /piwik/core/Mail.php, function initSmtpTransport

if (!empty($mailConfig['heloname'])) { $smtpConfig['name'] = $mailConfig['heloname']; }

and added "heloname = example.org" in my config.ini.php. Now it works correctly.

Greetings from Cologne - Bernd

@jtreml272 commented on September 28th 2018

Dear @bglxx would you be so kind and post your /piwik/core/Mail.php and config.ini.php.
I am trying to setup ma configs according to your advices but without success. Many thanks in advance. Josef

Powered by GitHub Issue Mirror