Configure WHM for Postmark SMTP Sending using Exim Configuration Manager
cPanel is a very popular control panel for hosted sites and web applications. Use this article to configure SMTP sending with Postmark using your Exim Configuration Manager in cPanel’s WHM.
Access Your Exim Configuration Manager in WHM
Log into your WHM account and click Exim Configuration Manager under Service Configuration. You can also search for Exim in the navigation area to pull it up quickly.
Set Your SmartHost to Postmark
You will be placed into the Basic Editor by default. Scroll down until you reach Smarthost Support under the Mail header. Enter smtp.postmarkapp.com:587 like in the screenshot below. Scroll down and click ‘Save’. This will regenerate your Exim configuration file.
Once completed, navigate to the Advanced Editor tab in your Exim Configuration ManaScroll down in the Advanced Editor until you reach the AUTH section. Enter the following, so that it matches the screenshot below. Note, you will want to use your Server API Token from Postmark where it says ‘YourServerAPITokenHere’.
auth_login:
driver = plaintext
public_name = LOGIN
hide client_send = : YourServerAPITokenHere : YourServerAPITokenHere
Scroll further down until you see the PREROUTERS section. Enter the following, so that it matches the screenshot below.
smart_route:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
transport = auth_relay
route_list = * smtp.postmarkapp.com
no_more
Scroll down to the TRANSPORTSTART section and enter this:
auth_relay:
driver = smtp
port = 587
hosts_require_auth = $host_address
hosts_require_tls = $host_address
Scroll to the bottom and click Save. Your Exim configuration will be regenerated again and restarted with the configuration changes you made.
Test
You can now send a test email from your server. As an example, in CentOS 7.2 with cPanel/WHM in a DigitalOcean droplet, the following will send a test email using Postmark:
$ mail -s "Postmark Test" recipient@emaildomain.com < /dev/null
Log into Postmark and you will see the email in your activity from the server. If you sent to a legitimate email address, the email will appear in the inbox as well.