| Configure MailStation 2 on Synology DS211j |
|
|
|
| News - Ubuntu / Linux / Unix |
| Written by Mark Veenstra |
| Monday, 05 September 2011 11:23 |
|
Many of you already know that I own a Synology DS211j personally. For a company which I help with the IT infrastructure I have ordered an DS710+. This company is pretty small and the main future they are going to use is the NAS functionality and the MailStation 2. But before I ordered this DS710+ I have tested MailStation 2 on my DS211j. So for those who are interested here a tutorial about how to setup MailStation on a DS211j. This tutorial should also work for other DS models. First of all you need to login into your DSM (http://yourip:5000). When you are logged into DSM go to 'Configuration'. Then click on 'Mailstation'. Then check the following boxes:
Also enter your domain name and enter a maximum size per email. Then go to the tab 'Settings for receiving email'. In this tab check the following boxes:
At this point your MailStation is configured and ready to use. But before everything will work, you should follow the rest of this tutorial. Because at this point the POP3 server is running on port 110 and SMTP is running on port 25. This can be a problem for some users. This because or your ISP is blocking all ports below 1024 (as my ISP does) or they are just blocking port 110 or 25. To be sure and test if one of these ports are blocked by your ISP, do the following test. Log into your router and activate a port forwarding. You can find a tutorial for your router here. Make sure you open port 25 and forward this to your internal IP of your NAS. Do the same for port 110. If your port forward is setup, write down your IP address. You can find your IP by opening a browser and go to http://whatismyip.com. Once written down please go log into an computer outside of your network and be sure you have internet on this PC. On this PC open a command prompt. Once you are in the command prompt enter the following: telnet yourexternalip 110
Do the same test for the SMTP server: telnet yourexternalip 25
If one of these connection fail, then you should follow the tutorial from POP3 redirection when POP3 failed. When SMTP failed, you should follow the tutorial from SMTP redirection. If none of these tests failed, you should follow the tutoral from setup MX records for your domain. POP3 redirection To redirect your POP3 server from poort 110 to another port is very simple. Log back into your router and change the port forward. You have now forwarded port 110 from the outside to 110 on your internal IP. Change this port forward. For example forward port 55110 from the outside to 110 on your inside IP. Your POP3 server is now available on port 55110. When you configure Outlook for example in the advanced settings you can set the POP3 server port. Set this to 55110. SMTP redirection SMTP recirection is a bit harder, but not impossible. Unfortunally SMTP has just a standard port on the whole internet. Luckely for us there are some services on the internet that handle SMTP redirection for people who have ISP's that block port 25. I use dnsexit.com for SMTP redirection (not free). But you can search the internet for other free services or choose your own service. Once you have found one, register to it. I have setup my dnsexit.com account as follows:
As you can see I have entered markdark.dyndns.org as my NAS external IP. This is because I don't have a static IP from my ISP. If you have a static IP you can enter your IP address. If you dont't have a static IP address, I recommend to use DynDNS also. Please read forward in this tutorial 'I have no static IP'. For the alternate port you mail server is listingin at I have entered port 8001. This means that I have chaged the port forward in my router. I have changed to outside port to 8001 and the inside port to 25 on my internal IP of the NAS. Setup MX records for your domain Finally you have to setup the MX records of your domain. Here is an example of my DNS records. I will explain them:
The company that is handling my DNS wants me to add a CNAME first in order to have my own MX record. So therefore I have added the CNAME mail.markinthedark.nl that points to my SMTP redirector smtp.dnsexit.com. If you don't need a SMTP redirector, you can enter your external IP instead of smtp.dnsexit.com. I also disabled the standard MX record that points to the mail server of my DNS provider. Then I added a new MX record that points to the created CNAME. So the MX record points to mail.markinthedark.nl. And this mail.markinthedark.nl points to smtp.dnsexit.com (through the CNAME). I have no static IP If your ISP doesn't give you a static IP, this can be solved by using an DynDNS account. The Synology can update your DynDNS account automatically when the IP changes. In this way your mail server can be reached al the time. To enable DynDNS, go to their website at http://www.dyndns.org and register for an free account. Enable your DynDNS account as follows (screenprint from my DynDNS):
Now your account is setup it would be handy that you NAS is updating the DynDNS account with a new IP address when your ISP is changing your IP. In this way everything is managed automatically without any user interference. So now log back into your Synology NAS (http://internalip:5000). Once you are in DSM go to 'Configuration'. Below 'Network services' you will find an option called 'DDNS'. Click on this feature. In this DDNS feature enter your DynDNS account as follows:
Save your settings and you are ready to go! If you are experience any problems with sending email through MailStation or RoundCube, please read further. Setting up SMTP relay host for MailStation Log into your Synology NAS using SSH (for example using Putty). Please log into SSH with the user root (same password as the admin user). Open the file '/usr/syno/mailstation/etc/main.cf'. In this file search for the setting 'relayhost ='. Edit the first entry and remove the # in front of it. And set the value to your ISP SMTP server. For example in my case it looks like this:
# The relayhost parameter specifies the default host to send mail to After this you may stop and start MailStation. If you don't now how, please reboot your NAS. If you still encounter any problems with sending mail you could change the setting of the relayhost to following:
# The relayhost parameter specifies the default host to send mail to Adding of the brackets ([]) makes sure that the domain is not resolved by the NAS. Hope this all helps you with setting up MailStation 2 on the Synology. If you have any questions please comment the article! |
| Last Updated on Wednesday, 07 September 2011 15:21 |




Click here to hear this article





Comments
thanks
I've followed the guide and got stuff working but can't get the SMTP relay 'bit' to work. I can't telnet to the required files..I am a total noob and any help you can offer would be great?
If i setup the MailStation, and it is set to retrieve mails from my provider, can I use a PC to retrieve these mails from the MailStation while maintaining the identity of the sender?
This is also setup such that the MailStation will store the emails as a backup, while the PC will also have the same emails.
I will add this feature into MailStation Plus (don't know when yet, but I will).
For now you can do this manually:
# Create pass file
vi /usr/syno/mailstation/etc/sasl_passwd
smtp.yourhost.com username:passwo rd
# Set file permissions
chown root:root /usr/syno/mailstation/etc/sasl_passwd
chmod 600 /usr/syno/mailstation/etc/sasl_passwd
# 16.1.3 Create sasl_passwd DB file
/usr/syno/mailstation/sbin/postmap/postmap /usr/syno/mailstation/etc/sasl_passwd
# Add to main.cf config file:
smtp_sasl_auth_ enable = yes
smtp_sasl_passw ord_maps = hash:/usr/syno/mailstation/etc/sasl_passwd
smtp_sasl_secur ity_options =
# Reload postfix:
/usr/syno/mailstation/etc/MailStation-018.sh restart
Great article.
(I am using DNS Made Easy by the way. Tried MXGuardDog for a day or two but their service sucks. Random occurances of mail not getting delivered to my mail server etc., but that one is free)