Nginx – sending a mail via php works but page times out

emailnginxPHPsendmail

I have a new server running ubuntu, nginx, php sendmail etc.

To test if sendmail is working I made a basic php file with the php mail function in it. When I execute the file my browser hangs until I get a 503 timeout but I still receive the test mail a few seconds later indicating sendmail is working.

Other pages on the server load just fine

The server does not have a domain name; I am just using its IP address for now.
There are no errors in the nginx error log but the mail log is showing errors like

sergeserver sm-msp-queue[13609]: unable to qualify my own domain name

Any ideas why and how to solve?

Here is the contents of etc/hosts

127.0.0.1       localhost

# --- Gandi DHCP Script ---
95.142.166.209  sergeserver
# --- End ---

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Best Answer

The quickest hack to make this error message go is to try and add the following lines in your /etc/mail/sendmail.mc:

LOCAL_CONFIG
Djsergeserver.example.net

Do not use any random domain as a FQDN. Use either a domain that you own, or example.net. After editing sendmail.mc make sure you generate sendmail.cf and restart sendmail. In Debian you do this with sendmailconfig. In CentOS you run /etc/mail/make followed by service sendmail restart.

Related Topic