matomo icon indicating copy to clipboard operation
matomo copied to clipboard

SMTP Email being Rejected <localhost.localdomain>

Open 0FiRE0 opened this issue 2 years ago • 3 comments

Software Info: Matomo v4.14.2 and also v4.13.x Platform: Docker

I have Matomo being deployed in a docker container, and I have another container for the email server. There is an issue after configuring the email settings in Matomo which is preventing it from sending any emails.

The issue is in the "EHLO" command to the email server, where it specifies a value of <localhost.localdomain> in the domain rather than the actual domain name (E.g. <mail.domain.com>). Noting that when inquiring about the email server using nslookup command it works fine and resolves the public IP Address of it.

I couldn't find a way to see and configure this value to fix it.

Below is a screenshot from the logs: image

0FiRE0 avatar Jun 05 '23 21:06 0FiRE0

Hi @0FiRE0 Thanks for the report. The library we are using (PHPMailer) actually allows to set/overwrite the hostname used for such requests. Nevertheless the default should be the current hostname. localhost.localdomain should only be used if PHP fails to detect a valid host name.

sgiehl avatar Jun 06 '23 11:06 sgiehl

Nevertheless the default should be the current hostname. localhost.localdomain should only be used if PHP fails to detect a valid host name.

Hi @sgiehl I am hit with this topic today, could we provide a config setting to allow changing this value ? Other softwares provide such option to change the ehlo value. I use the Debian packaged version, so I am not sure why it could not detect the hostname.

williamdes avatar May 31 '25 16:05 williamdes

@williamdes There is already a config called defaultHostnameIfEmpty, but by the looks it's not used to set the hostname for emails correctly. Could you check if adding $phpMailer->Hostname = $mail->getMailHost(); somewhere in Piwik\Mail\Transport::send() method would fix that?

sgiehl avatar Jun 02 '25 09:06 sgiehl