How to configure apache / php / postfix website emails when using vhosts?

Posted by Alistair Buxton on Ask Ubuntu See other posts from Ask Ubuntu or by Alistair Buxton
Published on 2012-10-14T02:23:47Z Indexed on 2012/10/14 3:51 UTC
Read the original article Hit count: 237

Filed under:
|
|
|

I have a LAMP webserver configured to serve multiple websites. Each virtual host has various PHP applications, mainly Wordpress.

When users sign up to the Wordpress sites, email is sent by PHP through to postfix, and then on to the receiver. The problem is that postfix is identifying itself to the remote server with the contents of /etc/hostname, which is not a fully qualified domain name. Some mail servers reject this and the mail bounces.

Additionally, the return path is being set to one of the vitual host domains, seemingly at random.

I could set /etc/hostname to one of the website domain names, but then the emails from the other websites would have a wrong server in the headers, and this would not fix the return-path issue.

Possibly related, apache2 says "could not determine the server's fully qualified domain name" on startup.

How do I fix this so that each website can send email without revealing the other websites hosted on the server?

© Ask Ubuntu or respective owner

Related posts about apache

Related posts about email