Why is sending mail with PHP from my firewall so slow?

I install Vagrant Box (precice64) using PHP5.3 and try to send him an email, but it is very slow. I have a simple script like:

$ok = mail('me@domain.com', 'test', 'test');
var_dump($ok);

And run it on the command line (or in the browser, it does not matter):

$ php mail.php

Mail is sent, but the script takes 30 seconds to a minute! Does anyone know what might cause this delay?

+4
source share
2 answers

I solved this by following Glavich’s link.

I edited /etc/hoststo include the hostname of my Vagrant Box (exact64):

127.0.0.1 localhost.localdomain localhost myhostname precise64

And added the following line to /etc/mail/sendmail.conf:

HostsFile=/etc/hosts

Now it works like a charm!

+3
source

hosts: 127.0.1.1 fullQualifiedHostname

+1

All Articles