Using Zoho mail, PHP mail() goes to spam.

February 1, 2016 1.2k views
Email DNS Getting Started

Okay, I'm a very newbie to Linux servers.

I am running LAMP stack on my droplet. All the mail system is powered by Zoho mail (some kind like Google Apps).

I wrote a PHP web app, and the e-mail sent from mail() goes directly to spam in Gmail.

Here is the information obtained from Gmail when I send my Email from the PHP web app:

Delivered-To: t******
Received: by with SMTP id r197csp2640062oie;
        Mon, 1 Feb 2016 01:03:13 -0800 (PST)
X-Received: by with SMTP id n27mr4882881ioi.132.1454317393436;
        Mon, 01 Feb 2016 01:03:13 -0800 (PST)
Return-Path: <>
Received: from ([])
        by with ESMTPS id u4si13948179igr.88.2016.
        for <t******>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 01 Feb 2016 01:03:13 -0800 (PST)
Received-SPF: neutral ( is neither permitted nor denied by best guess record for domain of client-ip=;
       spf=neutral ( is neither permitted nor denied by best guess record for domain of
Received: from (localhost [])
by (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id u1193BBg002012
    for <t******>; Mon, 1 Feb 2016 04:03:11 -0500
Received: (from www-data@localhost)
    by (8.14.4/8.14.4/Submit) id u1193B54002011;
    Mon, 1 Feb 2016 04:03:11 -0500

The line "Received: from (localhost [])" made me think I'm configuring something very, very wrong.

I've tried changing the host name to, and tried editing /etc/hosts to make sure the IP points to my domain. What can I do next?

1 Answer

You should add - verify DKIM and SPF with your domain name in Zoho mail app settings. This gives mail exchange verifies and chances of getting into inbox is very high (unless there are many links, many spam keywords)

  • Hello, thank you for replying.

    I would follow the instruction given. However, I have to inform to you that the mails sent from Zoho mail doesn't go to spam box, and could I have some information about how updates on Zoho could be related to mails sent from PHP server?

    I'm very new to Linux servers, thank you for informing and sharing me knowledges!

    • For PHP mail, add IP - Server's rather than localhost, DKIM, SPF in email server(like postfix )config. Search for digitalocean ubuntu DKIM and SPF.

Have another answer? Share your knowledge.