Email: Send emails via SMTP Relay

As of TurnKey v14.2, Confconsole supports SMTP relay configuration. If you are running an earlier v14.x release, then you can upgrade to the latest version of Confconsole fairly easily. Alternatively, you can use the manual config instructions below.

Also, there is some info and discussion related to older TurnKey versions on the forums.


As of v14.0 all TurnKey apps include postfix MTA. The other dependencies are libsasl2-2 & ca-certificates (although these should be installed in all TurnKey appliances already). For v14.0+ you will only need to install one additional SASL library:

apt-get install libsasl2-modules

For users of earlier TurnKey apps, this should work:

apt-get install postfix libsasl2-modules libsasl2-2 ca-certificates


The following postfix configuration is general for all smtp relay services tested to date:

append config to /etc/postfix/ :

cat >> /etc/postfix/ <<EOF

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/private/cert.pem
smtp_use_tls = yes
inet_protocols = ipv4

Depending on what relay service you're using the following steps might be slightly different. The following examples show how to setup using the Gmail SMTP relay service, Elasticemail's service and Amazon SES. If you have a different service, then hopefully the below will give you some ideas to check.



(It is recommended that you DO NOT use your personal gmail account for this)

add Gmail as the SMTP relay in /etc/postfix/ :

sed -i "s|^relayhost =.*|relayhost = []:587|" /etc/postfix/

then add your username and password to /etc/postfix/sasl_passwd Replace USERNAME with your username (note for Google Apps accounts replace with USERNAME@YOUR_DOMAIN.TLD) and PASSWORD with your password.

cat > /etc/postfix/sasl_passwd <<"EOF"

run postmap on your new password file

postmap /etc/postfix/sasl_passwd

If for whatever reason you disabled TLS you'll need to allow access to your gmail account from postfix, to allow that go to the following link when logged into your google account and click "Turn On" However it is highly recommended you don't do this.

Finally restart postfix"

service postfix restart

and you're done!



First of all as with the gmail setup you'll need to edit /etc/postfix/ and set your relayhosts to the relevant host, in this case

sed -i "s|^relayhost =.*|relayhost = []:587|" /etc/postfix/

and then you'll need to set your login details inline with the ones you find at in your /etc/postfix/sasl_passwd file
 like so (replace USERNAME and PASSWORD with your username & password).

cat > /etc/postfix/sasl_passwd <<"EOF"

now run postmap on your /etc/postfix/sasl_passwd file

postmap /etc/postfix/sasl_passwd

and restart postfix and you should be good to go!

service postfix restart


Amazon SES

Firstly you'll need to choose your preferred region and obtain your SMTP account details (not the same as your amazon account details). You can read about this from the following links. Region List SMTP Credentials

You'll also need to authenticate the email address you wish to use to send mail, you can do this from Amazon Console by clicking SES, then "Email Addresses" under "Identity Management"


now we'll need to edit /etc/postfix/

if you see a line with "relayhost =" replace that, otherwise add the following to the end

relayhost = [region-you-selected]:25

now you'll need to edit /etc/postfix/sasl_passwd so it has authentication to access the server with.

[region-you-selected]:25    smtp-username:smtp-password

now run

postmap /etc/postfix/sasl_passwd

and restart postfix and your server should be working


If you are still in sandbox mode you'll have to authenticate the addresses you send mail too as well as the addresses you send mail from.


Jeremy Davis's picture

Hopefully I've fixed it now :)