An error occurred while sending 'HTML Email Report - Error was 'Dovecot ready. '

I have no clue how emails are being sent from within Matomo, all my platform was working fine and I assume that I did a system update. This seems to have broken my postfix application. I cannot send emails from the OS. Postfox was configured as a send-only service. This has stopped working.
As a result of this email reorts are not being sent from within Matomo. I get the error “An error occurred while sending ‘HTML Email Report - 1.2019-11-15.2.en - gRsstZ1nZUshGM5Gy48b2YABbU89iw7HcrkuFHJ7.html’ to lawrence@e2snail.com. Error was 'Dovecot ready. '”
I have downloaded and updated PHPMailer, how can I get the email process to use PHPMailer or how can I test and gather logs within Matomo to try to understand why mails are not being sent.
Thanks
Lawrence

Hi,

The E-Mail system in Matomo is a bit old, so it isn’t impossible that it simply doesn’t support your mailserver. If you have access to the mailserver, you could check the error logs there for more clues.

There is ongoing work to replace the system with something modern that should work fine in most cases and be more helpful in the others

but until then you could try out disabling SMTP in the settings which makes Matomo use the PHP mail() feature and then set up PHP itself to properly send mails.

Hey Lucas,
Thanks for your reply, with me not being a developer I hope my reply makes sense. I will follow up and validate thought to confirm.

I am not aware of a general setup for php to hand mail by default. As far as I have read and can gather, I need to have the mail config added to any php scripts that you need/want to process mail.

In your reply you say check the logs. What logs are you referring to, I have checked the syslog and mail.log and there are no entries there. I have also only found one location where logs can possibly be saved, …/tmp/logs, but there are only two files in that location. index.htm and index.php. Please advise.

After much research, I have managed to get the following script working to check and validate email credentials, bu I have no clue how I would incorporate this to work with Matomo. So any help from your developers would be much appreciated. Script is below.

<?php 

    include_once('/usr/share/php/vendor/phpmailer/phpmailer/src/PHPMailer.php');
    include_once('/usr/share/php/vendor/phpmailer/phpmailer/src/SMTP.php');
    include_once('/usr/share/php/vendor/phpmailer/phpmailer/src/Exception.php');

    use PHPMailer\PHPMailer\PHPMailer;
    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->Host = 'mail.example.com';
    $mail->SMTPAuth = true;
    $mail->Username = 'info@example.com'; //paste one generated by Mailtrap
    $mail->Password = 'XXXXXX'; //paste one generated by Mailtrap
    $mail->SMTPSecure = 'ssl';
    $mail->Port = 465;
    $mail->setFrom('noreply@example.com', 'HockeySticks4CLubs');
    $mail->addAddress('info@example.com', 'HockeySticks4CLubs'); 
    $mail->Subject = 'Website Contact Form:  $name"';
    $mail->isHTML(true);
    $mailContent = "You have received a new message from your website contact form.";
    $mail->Body = $mailContent;
    $mail->send();


    if($mail->send()){
    echo 'Message has been sent';
     }else{
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
    }
?>

Thanks
Lawrence

I am really sorry and stupid, I only realised that I pasted my password and mailserver details in my last post. so thank you admin for removing that and formatting the php for me.

I was thinking about the comment made to disable SMTP, if I did that how would Matomo know what php file to use and link the report to?

Something else that I noticed but I hope is not an issue, I saw that to view logs in Matomo, I need to purchase the log viewer. Surely there are normal logs generated that a support person can login and find issues with the platform.

Lawrence

You’re welcome :slight_smile:

Matomo would just call the PHP mail() function (https://www.php.net/manual/en/function.mail.php) which then in turn calls whatever you have set up in the php.ini sendmail_path option (by default sendmail -t -i). So if you could set up the php.ini to forward the mail to your SMTP server (e.g. with msmtp https://packages.debian.org/buster/msmtp).

You don’t need to. The logs are saved in tmp/logs/matomo.log and can also be viewed in the free LogViewer plugin.

The paid plugin https://plugins.matomo.org/ActivityLog has nothing to do with error logs and is just needed when you want to know when which user changed which setting.

Lucas,

I just checked and no dir exists /tmp/logs

Lawrence

It isn’t in /tmp/ but in the tmp directory in your Matomo directory

Lucas,

If you read my original post, I said that in the dir …/tmp/logs there are only two files there. index.html and index.php. Nothing more.

Lawrence

In that case you have to enable logging first as mentioned in How do I view Piwik application logs? FAQ - Analytics Platform - Matomo