Is Sendmail configurable through Postmark?

If you use our SMTP server option, you can use a smarthost in Sendmail to relay mail through Postmark. A big advantage of this is that it requires no changes to your application code and the local mail server will queue emails on its own. For instance, in the case there are connection problems to Postmark, the emails will be queued and retried.

Follow the Sendmail configuration steps below to relay SMTP emails through Postmark.

Installing Sendmail

Red Hat Enterprise Linux:

yum install sendmail sendmail-cf

Debian:

apt-get install sendmail sendmail-cf

Hosts setup

Add your FQDN (fully qualified domain name) to /etc/mail/local-host-names:

hostname -f >> /etc/mail/local-host-names

Ensure that are able to ping your FQDN by performing the following:

ping $(hostname -f)

Authentication setup

Append the following to /etc/mail/sendmail.mc, replace API token with your API token.

AuthInfo:smtp.postmarkapp.com "U:APItoken" "P:APItoken" "M:PLAIN"

Command:

echo "AuthInfo:smtp.postmarkapp.com "U:APItoken" "P:APItoken" "M:PLAIN"" >> /etc/mail/access

SMTP configuration

Add, or modify, the following lines to /etc/sendmail.mc:

define('SMART_HOST', 'smtp.postmarkapp.com')dnl
FEATURE('access_db')dnl
define('RELAY_MAILER_ARGS', 'TCP $h 25')dnl
define('ESMTP_MAILER_ARGS', 'TCP $h 25')dnl

Make configurations

Perform the following to create the Sendmail and access configurations.

Command:

cd /etc/mail ; m4 sendmail.mc >sendmail.cf ; makemap hash access <access

Test setup

Restart Sendmail:

/etc/init.d/sendmail restart

The following will send an e-mail from the command line:

echo "testing" > testing.txt ; mail -s "testing" your@email.com < testing.txt ; rm testing.txt

Generally, any configuration problems will be highlighted in the mail log (/var/log/maillog).

Last updated March 21st, 2016

Still need some help?

Our customer success team is here to help!