Maildev is running with
maildev -s 25
PHP is setup with
[mail function]
SMTP = 127.0.0.1
smtp_port = 25
When I try to send mail (with PHPMailer), I see that sendmail is running:
0784 www-data 20 0 4508 748 672 S 0.0 0.0 0:00.00 sh -c /usr/sbin/sendmail -t -i -oi [email protected]
And after about ~2mn, that process ends and mails are sent to Maildev.
I don't understand why mails are not directly sent to Maildev...
It is the SMTP mail delivery (which PHP hands off the message to) which is taking time. Possibly, the delay you see is greylisting on the receiving server, meaning that the receiving mail server refuses to accept the message until the sending server (which your PHP script handed it to) tries a few times.
The most common reason for slow sendmail startup is DNS not resolving.
Introduction. PHP comes with a default function mail() that allows you to sendmail directly from a PHP script.
Some mail programs (most, today) will connect directly to a mail server and speak SMTP to it. However, the "traditional" method - and arguable the better method - is to let sendmail do it.
I finally found it!
In my /var/logs/mail.log I had this error log:
My unqualified host name (hugo) unknown; sleeping for retry
Then 1 minute later :
Unable to qualify my own domain name (hugo) -- using short name
I fixed this error with https://askubuntu.com/a/436270/510570, by:
Setting a good FQDN in my /etc/hosts
file:
127.0.0.1 hugo.example.com hugo
And applying it:
sudo hostname hugo.example.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With