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.
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–
6) Install Postfix as the MTA (more secure than sendmail, widely used)–
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
(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.
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.