How to make your Synology DiskStation a mail server
Synology's Mail Server package allows your DiskStation to become a mail server that supports SMTP, POP3, and IMAP. With Mail Server, user accounts and email messages can be centrally managed and archived on your DiskStation. In addition, the Mail Station package provides DSM users with an easy-to-use, browser based email client for viewing, managing, and sending messages.
In the guide below, we will help you get started with Mail Server and Mail Station on your Synology DiskStation.
- 1.1 Mail User Agent (MUA)
- 1.2 Mail Transfer Agent (MTA)
- 1.3 Mail Delivery Agent (MDA)
- 1.4 Simple Mail Transfer Protocol (SMTP)
Whenever you send an email, your mail user agent (MUA) interacts with the mail transfer agents (MTA) in order to get the mail to the right destination. Check out the illustration and explanation below.
A mail user agent (MUA) is an application (e.g. Outlook Express, Thunderbird) that runs on a user's computer. Mail user agents are used to compose and send messages, as well as to display and manage messages in a user's mailbox.
Mail transfer agents (MTA) are used to pass email between different mail servers. When a mail user agent passes a message to a mail transfer agent, the latter passes the message to another transfer agent (or possibly many other transfer agents). Transfer agents are responsible for properly routing messages to the destination. Synology's Mail Server package allows a DiskStation to handle some of functions of a mail transfer agent and mail delivery agent (see below).
Mail delivery agents (MDA) are used to place messages into a local user's mailbox. When the message arrives at its destination, the final transfer agent gives the message to the appropriate delivery agent, and the latter delivers the message to the user's mailbox.
Simple Mail Transfer Protocol (SMTP) is an Internet standard for email transmission over Internet Protocol (IP) networks. While mail transfer agents use SMTP to send and receive mail messages, mail user agents only use SMTP for sending messages to a mail server for relay.
Some preparation work is required to get Mail Server running smoothly on your DiskStation. Before starting, please pay special attention to the information below.
There are three ways to connect your DiskStation to the Internet: direct connection, PPPoE connection, or connection though a router. For details about accessing your DiskStation via the Internet, refer to this tutorial.
Having a static IP address is crucial for a mail server. Although it is possible to run a mail server with a dynamic IP address, it is not as reliable as using a static IP address. We recommend registering a static IP address for your mail server (For more information, please contact your Internet service provider).
A valid, registered domain name is required to allow clients to deliver emails to Mail Server over the Internet. In addition, you'll need to set up the MX record and A record of your DNS server.
MX record, or Mail Exchanger record, is a type of resource record in the Domain Name System (DNS). It specifies how Internet email should be routed using Simple Mail Transfer Protocol (SMTP). Each MX record contains a host name and a preference. A host name guides emails to arrive at the right destination. A preference points out the relative priority of various servers.
For example, to make sure an email address like "firstname.lastname@example.org" works properly, you have to set up the MX record of the domain "example.com." To do so, you need to point the MX record to the IP address or domain name of your DiskStation. If you already have registered a domain name, you'll be able to modify these settings in the management console for that domain name.
If you don't have a registered domain name, you can apply for a free DDNS domain name (although this might affect the usability of your mail server). It is recommended to have a static IP address with DDNS to ensure that the email delivery is more reliable. You can apply for a registered DDNS hostname by logging into DSM and going to Main Menu > Control Panel > DDNS.
The process of assigning specific DNS records to a domain name is known as Forward DNS. This is what leads the domain name to the exact server. However, there is also a reverse process, known as Reverse DNS.
‧ What is reverse DNS?
Reverse DNS refers to translating the numeric addresses of a website (i.e. the IP address) to the domain/host name, as opposed to the forward DNS process which translates the domain/host name to the IP address. Reverse DNS refers also to locating which domain name/host belongs to a given IP address, that is why this process is often referred to as Reverse DNS Lookup. When a domain name has a valid reverse DNS, it can also be accessed by just using the IP address.
‧ What does reverse DNS do?
Why would you need a reverse DNS set up for your mail server? Reverse DNS is one of the basic requirements for running a mail server. It is often used as a spam filter to determine whether the IP address of the incoming message matches an authenticated domain name, and to block the message if it doesn't. If you don't set up Reverse DNS for your mail server, messages sent from your mail server will be blocked by most major email services.
If you can't set up reverse DNS by yourself and keep on experiencing email delivery problems, please add another SMTP server for normal email delivery. We recommend that you use a more well-known SMTP server to avoid being taken as spammer when sending an email.
‧ How to set up Reverse DNS
Set up Reverse DNS on your own host -- Some ISPs may delegate a portion of the zone to you so that you can host your own reverse DNS. You can configure Reverse DNS by determining PTR records in a DNS server. PTR records are managed by the entity that controls the IP address assigned to you. It may be either your host or yourself, if the host has delegated the Reverse DNS for your IP space (containing one or multiple IP addresses) to you. A PTR record usually represents the IP entered backwards, followed by an in-addr.arpa entry.
Set up Reverse DNS with your ISP -- The ISP or entity that owns your IP address is the only one who can add the appropriate PTR records. You may have to contact them for Reverse DNS configuration.
Once the above preparation work is finished, we can start installing and setting up Mail Server by following the steps below.
With Mail Server, users' sent and received messages are stored in each user's "home" directory. Follow the steps below to enable user homes on the DiskStation.
- Log into DSM with an account belonging to the administrators group.
- Go to Main Menu > Control Panel > User.
- Click User Home.
- Tick Enable user home service.
- Go to Main Menu > Package Center to find and install Mail Server. For detailed instructions to install packages, please see this tutorial.
With the Mail Server package installed and user homes enabled, we can now start setting up Mail Server. In the section below, we'll look at enabling SMTP (Simple Mail Transfer Protocol). Please remember that the screenshots below are for reference only and your settings might differ.
For educational purposes, we'll use a free domain name provided by Synology in the instructions below. This domain name does not provide options to manage DNS records (which means we might encounter problems when sending messages to major email services), but is sufficient for practicing and learning about Mail Server. If you'd like to register for a free Synology domain name, please go to Control Panel > DDNS > Add.
- Open Mail Server and go to the SMTP page.
- Tick Enable SMTP. This option allows Mail Server to start transferring messages between mail servers.
- Enter your registered domain name in the Domain name field. This domain name appears after the @ in users' email addresses. For example, if "mydomainname.com" is entered here, then the email addresses of your users will look like "email@example.com".
- You can modify these additional settings according to your needs:
- Account type: Select which user account types (local, LDAP, or domain users) shall be allowed to use the services provided by Mail Server.
- Authorization required for mail clients except Mail Station: If this option is enabled, users must enter their DSM usernames and passwords for authentication when using other mail clients (e.g. Microsoft Outlook, Mozilla Thunderbird).
- Ignore authorization for LAN connections: Enabling this option removes the restriction above when the user's mail client is connected to the same local network as the DiskStation running Mail Server.
- Sender name and login name must be identical: If this option is enabled, a user's sender name (e.g. firstname.lastname@example.org) must be the same as his DSM username (e.g. username) when settings up mail clients.
- Port: Specify the port used for SMTP. The default port number for SMTP is 25.
- Maximum size per email: Specify the maximum size for email sent and received by users. This option can reduce the amount of storage space consumed by users' messages.
- Enable SMTP-SSL: Enable this option to secure SMTP connections with SSL.
- Click OK to save the settings.
Mail Station is an add-on package that provides a browser interface for users to access and manage email that is hosted on the DiskStation. In addition, multiple POP3 accounts can be created in Mail Station, allowing users to receive and store messages with other email services (e.g. Gmail, Hotmail).
- Go to Main Menu > Package Center to find and install Mail Station. For detailed instructions to install packages, please see this tutorial.
- There are two ways to find the Mail Station login page:
- Go to Main Menu > Mail Station.
- Enter the name of the DiskStation followed by /mail in the address bar of your web browser. For example, if the DiskStation is called mydiskstation, then enter mydiskstation/mail.
- Enter your DSM username and password to login.
- After logging in, the page below appears.
- If Mail Server settings were configured before installing Mail Station, the SMTP settings of Mail Server should automatically appear at Settings > SMTP Server Settings. If not, you can select it from the Select SMTP server menu.
Email accounts on the DiskStation can be linked with various mail clients, such as Microsoft Outlook or Mozilla Thunderbird. In the example below, we'll look at using Thunderbird to access an email account hosted on the DiskStation.
- Open Mail Server and go to the IMAP/POP3 page to enable IMAP or POP3 depending on the client.
- Launch Thunderbird on your computer and click Create a new account.
- Click Skip this and use my existing email.
- Enter the name, email address, and password for your DSM user account. (For example, "email@example.com".) Click Continue.
- Thunderbird searches for your address. If your settings are correct, you'll see the screen below.
- Now the email of the selected account will be displayed in Thunderbird!
6.1 Why can't I send or receive emails via webmail from Mail Station?
- Check if the settings on your Mail Station such as SMTP, DNS, and MX are correct.
- Check if the Internet settings of your Synology DiskStation are correct. Go to Main Menu > Control Panel > Regional Options page. In Time tab, tick Synchronize with a NTP server and click on the Update Now button to examine if the Internet settings are correct. If the result comes back successfully, the settings are correct.
- Check if the port number on your router is correct.
- Please visit http://www.spamhaus.org/sbl/ to check if your IP is listed as spammer. If so, remove your IP from blocklist on the same website.
6.2 Why can't I send or receive emails via my email clients?
- Check if you have enabled protocols for IMAP and POP3.
- Check if your username and password are correct.
- Check if the settings on your Mail Station such as SMTP, DNS, and MX are correct.
- Check if the Internet settings of your Synology DiskStation are correct. Go to Main Menu > Control Panel > Regional Options. Under the Time tab, tick Synchronize with a NTP server and click on Update Now button to examine if the Internet settings are correct. If the result comes back successfully, the settings are correct.
- Check if the port number on your router is correct.
- Check if your IP is listed as spammer. Go to http://www.spamhaus.org/sbl/ to check out. If so, remove your IP from block list on the same website.
6.3 Why can't I receive emails sent from another email server (e.g. Gmail)?
- Make sure the DNS is correctly configured. You will need to point the MX and A record to DiskStation. So other email servers can find the DiskStation.
- Make sure DiskStation has a static IP address and is connected to the Internet, or your domain name points correctly to your dynamic IP.
- If the DiskStation is set behind the NAT firewall/router, please make sure the port forwarding works. You can check whether the port forwarding works by going to the http://canyouseeme.org/ and inputting the port 25.
- Check message in the returned mail if any. So you can find the detailed reason of the error.
6.4 Why do I get rejected when I send emails to certain webmail accounts, like those of Gmail or Hotmail?
Many free email providers do a reverse DNS lookup to check the validity of the sender. If your reverse DNS lookup doesn't correspond to the sending domain name, you emails will be rejected. Please check with your ISP.
Another possibility is that your IP address is listed in the SPAM block list. You can check this by visiting http://www.spamhaus.org/sbl/.
Need technical support? Submit Support Form