Any issue if PHP mail() mail server not MX of FROM domain

emailmx-record

Suppose I have this scenario:

My mail server (and thus MX) for my email address me@company.com is hosted in my office.

My website company.com is hosted by third party web hosting company.

On my website I created a <form> with FROM, TO, SUBJECT, BODY and send out using PHP mail() to customers.

Since the web server is third party, PHP mail() uses localhost mail server.

I think that my mails will reach the customer's mail server and appear as "forged" or spam.

What do I need to do to ensure my mails appear legitimate and incoming mails will not be sent to the third party web host?

Best Answer

Your messages will be subject to the policies of the receiving domains - the only people who can tell you "What [you] need to do to ensure your mails appear legitimate" are the mail admins at those sites.

Some suggestions:

  1. Ensure that your mail form is reasonably secure - You don't want to inadvertently become a spammer.
  2. Make sure your FROM and REPLY-TO addresses point to the places you want bounces/replies/etc. to go
  3. Make sure that your web server is listed in your domain's SPF record
  4. Properly configure DKIM, if you so desire.
  5. If you will be sending bulk mail speak to the postmaster/bulk mail folks at the larger sites (Yahoo, Google, Hotmail, etc.)
  6. (Optionally) Configure your web server to use your normal MX as a Smart Host/Relay.
Related Topic