Hi,
I did not found enough information in these forums, that's why I wrote this complete manual.
setting up an internal mail server
setting up fetchmail on a synology DS209+II
Purpose: getting mail from a pop mailbox (using fetchmail) and distributing it to a local imap account.
In this case the imap server (using Mailstation) is only available for my local network.
It does not involve MX records, changing port/forwards...
So let's get started:
1. on the nas, make a user called 'mail' and enable user home
Note: the username 'mail' is important here, because the postfix program uses the same username. So if you want to use a different username, you also have to change it in the postfix configuration file (/opt/etc/postfix/main.cf).
2. download, install and then configure Mailstation:
write as FQDN: internalmailserver.com (or any other fictive name you pick yourself)
enable SMTP
enable webmail
3. log in as root into your nas using putty or telnet (make sure you enable it first in the configuration window of the nas)
4. do an update of ipkg (command: ipkg update) then install fetchmail (command: ipkg install fetchmail)
5. we don't want anybody else than yourself to be able to read the fetchmailrc file so do a command: chmod 600 /opt/etc/fetchmailrc
6. edit the file /opt/etc/fetchmailrc and fill in
poll yourexternalpopmailserver.com proto pop3:
user "joe", with password "yourpassword", is "mail@internalmailserver.com" here;
7.edit the file /opt/etc/init.d/S52fetchmail and change the ARGS line to:
ARGS="-d 60 -f /opt/etc/fetchmailrc -v -U --syslog"
Take a look at the fetchmail manual if you want different options here.
That's all for the settings! All you have to do now is run fetchmail.
From the command line you can run it with this command:
/opt/etc/fetchmailrc start
You can login to the roundcube webmail (user 'mail'), and read your new mails. If you can read your emails, then you can congifure your mail client (point to your nas, username: 'mail', port 143)
To start fetchmail automatically everytime your nas starts:
copy and rename the file /opt/etc/init.d/S52fetchmail to /usr/syno/etc/rc.d/S52fetchmail.sh
This will run the fetchmail daemon as root. This not advisable -so the daemon says- , but I don't know how to run it as another user. Maybe somebody can help me out here?
Hope this manual will be helpfull to someone.
Pieter




