Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a new VPS with 1 site. Very soon there will be a lot of sites here.

First problem from today: I noticed that emails that database backups that are being sent to my email are marked as spam. The reason is that they are being send by a fake email @localhost.localdomain.

I think and I am almost sure that the problem is the following:

root@me:/etc$ hostname --fqdn
localhost.localdomain

I understand I have to put a good domain here domain here.

Example: Let's say that next week in the VPS there will be 4 sites with 4 different domains:

aaa.com on public_html/aaa/
bbb.com on public_html/bbb/
ccc.com on public_html/ccc/
ddd.com on public_html/ddd/

In my opinion I can choose aaa.com as a FQDN. Please correct if I am wrong. But the problem of this choice would be that if ccc.com will send an email, than the receiver will see that this email came from aaa.com.

I want to avoid that. I will have several sites and I want the emails sent by a blog residing in /ccc/ to have ccc.com as the email sender. The scrips that is part of the domain ddd should send emails as ddd.com.

I know that it is possible to create PHP scripts that will allow to customize the mail "from", and it is possible to send emails via SMTP. However I need (must) rely on 3rd party Wordpress plugins and some of them cannot be customized. They just send PHP emails using the FQDN configured in the machine.

How can I configure the VPS in order to allow each site to send emails using their own domain and avoiding for all the sites to have the same domain 'from email'?

share|improve this question

closed as off-topic by Katherine Villyard, Jenny D, dawud, mdpc, Ward Feb 23 at 0:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Katherine Villyard, Jenny D, dawud, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 2 down vote accepted

Your machine can have only one host name set locally - use aaa.com or the random hostname that your VPS provider assigned. It's generally a good idea to have a reverse DNS entry that points to the same name that you're using locally.

When sending mail from your PHP apps, you should be able to set the sending address within the application, or if the application uses the PHP default, then set it in the PHP.ini for that site - see the PHP documentation for the mail function and ini setting sendmail_from.

http://www.php.net/manual/en/mail.configuration.php

share|improve this answer
1  
Thank you. I do already have a revdns to aaa.com - the most used and most popular site. I'll try to change the from email address from the php.ini. I look like this is what I needed. Thanks much. –  Pikk Feb 18 at 0:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.