installation guide for fetchmail on DS209+II

Anything about installing email packages on our server, such as xmail, can go here
Forum rules
Please note the disclaimer before modifying your Synology Product.

installation guide for fetchmail on DS209+II

Postby pieter9999 » Sun Mar 28, 2010 1:21 pm

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
pieter9999
I'm New!
I'm New!
 
Posts: 5
Joined: Sun Dec 06, 2009 6:52 pm

Re: installation guide for fetchmail on DS209+II

Postby HarryPotter » Sun Mar 28, 2010 1:58 pm

Nice work, thanks.

We would prefer to have such how-to in the Synology Wiki.

It would be nice if you could copy it over there.
*Please do not Private Message me for support questions; leave it on the forum so all members can learn. Thanks!*

DS712+ / DSM 4.2 3211 / 2 x HD204UI (RAID0) / LMS 7.7.2-007
DS110+ / DSM 4.2 3211 / HD154UI
DS408 / DSM 4.0 2228 / 3 x ST31000340AS (RAID0) + 1 x HDS721010KLA330
DS207+ / DSM 3.1.1636 / ST31000340AS + WD5000KS
DS-106x / DSM 4.0 2228 (from DS108j) /

2 Squeezebox 3 + Boom
Rapsody N35

APC Smart UPS SUA750i
User avatar
HarryPotter
Honorary Moderator
Honorary Moderator
 
Posts: 12352
Joined: Mon Oct 23, 2006 12:48 pm
Location: Switzerland

Re: installation guide for fetchmail on DS209+II

Postby quadrox » Tue Mar 30, 2010 9:25 am

Hi pieter9999,

Thanks for your installation guide. I am the proud new owner of a DS110j and I'm also new to Synology. Beside using the box as file server, this specific e-mail job - to collect from my POP3 account and "distribute" via IMAP to multiple clients - was the two most important features I expected the box to provide. The file server is working out-of-the-box. However, the e-mail thing was a bit more complicated.

Well, thanks to you - and to rob for his Re: Mail Station contribution, I now has it up and running. Great :D

If you put your receipe on the wiki - as proposed by Harry Potter - I would be happy to review and add my own comments to the problems I ran into. Just put a link for it here.
quadrox
I'm New!
I'm New!
 
Posts: 2
Joined: Sun Mar 28, 2010 7:39 pm
Location: Denmark

Re: installation guide for fetchmail on DS209+II

Postby sandman » Sun Jun 20, 2010 12:09 pm

As I experienced considerable problems with the configuration of the mail functionality on my DS209+ii, finally reverting to the fetchmail solution, I have drafted this graphical "how to". This "how to" doesn"t claim to be perfect or workable for your specific situation. I have noted the configuartion that worked for me.

I'am still confronted with 2 issues:

a. running the fetchmail script at boottime. Meaning that the script is automatically loaded when NAS reboots. (has been solved)
b. running the script as another user then root.

a. I have tried the code below but the fetchmail process is not listed when I list the running processes.

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


I have also tried putting the script at the following locations:
/opt/etc/init.d/
/usr/local/etc/rc.d

but without success

the scripts has the following permissions:
-rwxr-xr-x 1 root root 579 Jun 19 17:24 S52fetchmail.sh


Anyone an idea?
Last edited by sandman on Tue Dec 21, 2010 9:22 pm, edited 1 time in total.
User avatar
sandman
Beginner
Beginner
 
Posts: 20
Joined: Sun Jun 20, 2010 11:55 am
Location: Belgium

Re: installation guide for fetchmail on DS209+II

Postby sandman » Sun Jun 20, 2010 12:21 pm

All,

As I exprienced quite some difficulties setting up the mailfucntionality on the DS209+ii, I have drafted a graphical "how to". This to allow other DS209+ii users to hopefully more easily implement the fetchmail functionality.
Where I initially aimed at having a full blown mailserver, I finally contented with a fetchmail solution. The how to is provided as is, without claiming to be correct. I have noted the configuration that works for me. Please note that I'am no linux guru,

By the way, I could solve the reboot issue by increasing the script number (it's all explained in the doc enclosed)

http://www.box.net/shared/rgsrno9mqs
Last edited by sandman on Tue Jul 13, 2010 8:14 pm, edited 1 time in total.
User avatar
sandman
Beginner
Beginner
 
Posts: 20
Joined: Sun Jun 20, 2010 11:55 am
Location: Belgium

Re: installation guide for fetchmail on DS209+II

Postby muffinboy » Mon Jul 12, 2010 9:13 pm

Thanks for this great guide Sandman! I was looking for the exacte same setup.

I'm sure I can get going with your help, but I'm still a bit hesitant about it.

It will work, but it's not supported by Synology since it's not standard functionality. So, it might break in some future firmware update and I may well be not enough of an expert to recover.

This really should be a standard feature. The missing functionality is not that complicated :-)

Well, I just bought a second DS210j for offsite backup... I guess I should experiment some with that before applying this to my main DS.
2 x DS210j | 2 x 1.5TB Samsung 154UI in RAID1
muffinboy
Trainee
Trainee
 
Posts: 10
Joined: Sun Jan 18, 2009 2:24 pm

Re: installation guide for fetchmail on DS209+II

Postby sandman » Tue Jul 13, 2010 8:15 pm

thx, glad it could help you (nothing as frustrating as being left with something that doesn't do what you want) :-) .
User avatar
sandman
Beginner
Beginner
 
Posts: 20
Joined: Sun Jun 20, 2010 11:55 am
Location: Belgium

Re: installation guide for fetchmail on DS209+II

Postby tschon » Fri Jul 16, 2010 5:36 am

Thank you for the fine installation guide.

I still fail to understand why a script to install fetchmail has not been applied by Synology, taking into the consideration the many request for such a service.

I fully agree that "This really should be a standard feature. The missing functionality is not that complicated"

regards

Synology: DS-509+
Firmware: DSM 3.1
HDD: 5 x Western Digital WD15EADS 1.5 TB - Non - Raid
Router: Linksys 4220
User avatar
tschon
Trainee
Trainee
 
Posts: 14
Joined: Sat Mar 01, 2008 6:59 am
Location: Denmark

Re: installation guide for fetchmail on DS209+II

Postby Satrapo » Fri Nov 19, 2010 2:56 am

With this guide I was able to test fetchmail on my new ds211j, it works great thanks!

Now I've a very simple question: how to completely unistall fetchmail?

I'm new to linux so excuse me for my stupid question!!

Thanks!
Satrapo
I'm New!
I'm New!
 
Posts: 1
Joined: Fri Nov 19, 2010 2:51 am

Re: installation guide for fetchmail on DS209+II

Postby pieter9999 » Wed Dec 01, 2010 8:12 pm

To remove fetchmail type:

ipkg remove fetchmail

That's all

Take care!
Pieter
pieter9999
I'm New!
I'm New!
 
Posts: 5
Joined: Sun Dec 06, 2009 6:52 pm


Return to Email Mods

Who is online

Users browsing this forum: No registered users and 0 guests