Zoho email and Digital Ocean

May 13, 2016 4.3k views
Email

I have set up a Zoho email account to handle my email delivery from my site on Digitial Ocean.

I have an MX record for the site pointing to the Zoho server, and the emails are being delivered, but sometimes flagged as spam, depending on how sensitive the receiving email client is. My Yahoo account receives them fine; my Gmail account receives them but with a warning that sender can’t be confirmed. A third account sends them to spam.

The Zoho help files mentions the following, which may be the issue –

“In case you use webforms in your websites, which sends emails, the email sending server at your web-host, in most cases, tries to deliver the email locally, as the domain name in the 'To Address' matches with the domain name used with the website. Hence make sure that you configure 'Remote Server' for email delivery to ensure that you receive emails without any errors. Switch off any Local Host or Local email delivery configuration, which causes the emails to not reach the Zoho Mail servers at all.”

Does anyone have any ideas on how to set up my server to switch off local email delivery, or is this perhaps not the issue?

Thanks

4 Answers

PHPmailer solved my problem.

I uploaded the phpmailer code to my website and send mails via SMTP.
https://github.com/PHPMailer/PHPMailer

Sample php code is at https://www.sitepoint.com/sending-emails-php-phpmailer/

If you don't understand, read about it. You will learn by doing.

Perform a backup of some sort-- snapshot, web server block html folder, database, postfix folder.

I use the portable editions of WinSCP and PuTTY (have had issues with the DO QEMU console).

Digital Ocean Ubuntu NGINX Lemp droplet.

Zoho email service (ie external server).

Need to send email from a PHP form using mail() to an existing email address at Zoho.com.

No credentials required. Authenticates on DMARC, DKIM, SPF, reverse DNS.

1) Name the droplet as the domain name. This updates the PTR for reverse lookup and HELO. Until I named my droplet with FQDN, the Zoho server gave '451 4.7.1 Greylisted' errors.

Now NSLookup and ping -a return 'domain.ext' instead of 'lemp-s-1vcpu-2gb-sfo2-01.'

2) Set up DNS Records--

Substitute your domain name everywhere 'domain.ext' appears.

You will need A and AAAA records for both www.domain.ext and domain.ext.

Create a CNAME entry for Zoho login URL. For example: webmail.domain.ext to alias business.zoho.com.

https://www.digitalocean.com/docs/networking/dns/how-to/

3) Configure Email Link Between DO and Zoho--

Use the link below to

4) Add IP address to the SPF TXT record using the DO DNS manager--

v=spf1 ip4:dropletIPaddress include:zoho.com ~all

Authorizes Zoho to accept messages from stated ip address.

5) Use the MX Tool Box site to test if desired--

https://mxtoolbox.com/

6) Install Postfix as the MTA (more secure than sendmail, widely used)--

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-18-04

7) Modify Postfix Config--

First, open /etc/postfix/main.cf with a text editor like Nano.

Make the following changes and additions (Comment out the original entry with a leading # as backup.). Use your actual domain name in place of domain.ext.

myhostname = domain.ext

mydestination =

(The following three are for hardening Postfix security.)

inet_interfaces = loopback-only

disablevrfycommand = yes

smtpdhelorequired = yes

Run 'service postfix reload' after saving the file to apply settings.

https://linux-audit.com/postfix-hardening-guide-for-security-and-privacy/

8) Testing--

If you are confident in your PHP script, then visit the file with a web browser to trigger an email.

Otherwise, to simply test functionality of the PHP mail() command, download a free PHP mail test script.

Note any error messages if any. Look them up on the web for insight and explanation.

Check the mail.log file at /var/log/mail.log to aid in troubleshooting.

by Justin Ellingwood
by Hanif Jetha
Postfix is a popular open-source Mail Transfer Agent (MTA) that can be used to route and deliver email on a Linux system. It is estimated that around 25% of public mail servers on the internet run Postfix. In this guide, we'll teach you how to get up and running quickly using the Postfix mail server.
Have another answer? Share your knowledge.