Synology usage series 14: Setup Postfix SMTP server with gmail relay

Install Postfix on DS101j

* many tutorial I found from the web told me create client certificate in order to use gmail as relay. But the fact is that client certificate is NOT a must in order to talk to gmail SMTP. I just want the installation as simple as possible because all I need is to send out some alert email and some snapshot from the IP cam.

1. Login to the admin console. Create a user ‘mail’ and a group ‘mail’.

2. Telnet/SSH as root. Install postfix using ipkg. (uninstall xmail first if it is already existed)

# ipkg remove xmail
# ipkg install postfix -force-depends

Make sure cyrus-sasl and cyrus-sasl-libs are installed as well, if not..)

# ipkg install cyrus-sasl
# ipkg install cyrus-sasl-libs

3. Edit the configuration /opt/etc/postfix/

myhostname = my ddns domain name
mydomain = my ddns domain name
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks =,
relayhost = []:587

# SASL authentication
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/opt/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous

smtp_use_tls = yes
smtp_tls_CAfile = /opt/etc/postfix/cacert.pem

alias_maps = hash:/opt/etc/aliases
alias_database = hash:/opt/etc/aliases

Change the value to your network address.
Leave the rest of the options as default.

4. Create sasl password file, then hash it using postmap command

# vi /opt/etc/postfix/sasl_passwd

replace to your own gmail address, replace password to your gmail password.

# chown root:root /opt/etc/postfix/sasl_passwd
# chmod 600 /opt/etc/postfix/sasl_passwd
# postmap /opt/etc/postfix/sasl_passwd

5. Edit /opt/etc/postfix/transport

# vi /opt/etc/postfix/transport
* smtp:[]:587

6. Download the cacert.pem (I doubt this is necessary, but it won’t hurt doing this)

# cd /opt/etc/postfix
# wget

7. Start the postfix server


Now my cheap IP cam can send out email alert and snapshot though my DS101j 🙂

Love my DiskStation.

4 thoughts

  1. Pingback: » Synology DS207+ usage series 11 – Setup nail to send email from CLI (using gmail smtp) Blog of Ray

  2. Hello,

    I have tried what you say, but it doesn’t work on my ds210j :

    DiskStation> /opt/etc/init.d/S69postfix
    starting service postfix
    postfix/postfix-script: starting the Postfix mail system
    DiskStation> mailq
    postqueue: warning: Mail system is down — accessing queue directly

    Do you know where the problem can be ?

    Thanks !

  3. Hi there

    I did the following
    ipkg install postfix -force-depends but despite setting up a mail user and group. I got the following error:
    Creating new user(s) and group(s) … failed?
    Everything else said OK.

    Would you or anyone else happen to know what I did wrong?

Leave a Reply

Your email address will not be published. Required fields are marked *