0

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'?

Pikk
  • 339
  • 1
  • 6
  • 19

1 Answers1

2

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

hcsteve
  • 341
  • 2
  • 7
  • 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 '14 at 00:29