Good Evening,
I have a SOHO, and I like to access/answer my emails from every workstations. Of course everything should be kept up-to-sync. Furthermore, I'd like to avoid storing all emails on my ISP. Having a local IMAP server and fetching automatically the emails from my ISP sounds quite promising at first glance.
I plan to go for fetchmail to retrieve the email from the ISP and dovecot to provide the local IMAP server. Now I am a bit unsure about the setup. As far as I can see, it seems that most solutions found on the net involves a 3rd agent, for instance procmail.
Is it possible to go only with fetchmail and dovecot? If I understood correctly, dovecot comes up with a LDA that can be directly evoked from fetchmail using the mda directive. Is this correct?
Does someone have succeed in setting such configuration up?
As I am a noob regarding emails servers technology, any help, advice, pointers would be greatly appreciated.
TIA, Lew.
On 05/25/2011 04:42 PM, Lewis NH2 wrote:
Good Evening,
I have a SOHO, and I like to access/answer my emails from every workstations. Of course everything should be kept up-to-sync. Furthermore, I'd like to avoid storing all emails on my ISP. Having a local IMAP server and fetching automatically the emails from my ISP sounds quite promising at first glance.
I plan to go for fetchmail to retrieve the email from the ISP and dovecot to provide the local IMAP server. Now I am a bit unsure about the setup. As far as I can see, it seems that most solutions found on the net involves a 3rd agent, for instance procmail.
Is it possible to go only with fetchmail and dovecot? If I understood correctly, dovecot comes up with a LDA that can be directly evoked from fetchmail using the mda directive. Is this correct?
Yes. In addition to running my own email server which dovecot uses as my initial email store, I also download my ISPs emails from that account and "deliver them" locally giving me effectively one email Inbox. I can read my email (using IMAP) from any workstation in the house (I use thunderbird on all of them), but I let my laptop do the distribution into local folders for me (separating my 2-300 emails a day into local folders for perusal in groups).
Does someone have succeed in setting such configuration up?
Not the same as you, but similar.
As I am a noob regarding emails servers technology, any help, advice, pointers would be greatly appreciated.
You will need to run a local email server in order to do this, but if all of your email is coming from your ISP, you should be able to configure fetchmail to fetch it from your ISP for you and deliver it locally (to your local server), where dovecot can find it and present it to your MUA via IMAP.
TIA, Lew.
On Wed, 2011-05-25 at 22:42 +0200, Lewis NH2 wrote:
I plan to go for fetchmail to retrieve the email from the ISP and dovecot to provide the local IMAP server. Now I am a bit unsure about the setup. As far as I can see, it seems that most solutions found on the net involves a 3rd agent, for instance procmail.
Is it possible to go only with fetchmail and dovecot?
Yes, I've done that for years, and still am. Fetchmail gets my mail about every 9 minutes, continuously[*]. However, with that simple two process approach, all your mail just waits in your inbox.
If, you do add in the third handler, it can sort your mail into different folders, as it comes in. Otherwise, you'd sort through your inbox using your mail client, which can be annoying, and tedious to manage when you use various different mail clients on different computers.
* Each user has a ~/.fetchmailrc script which lists mail server addresses to poll, along with usernames and passwords. And you can put command lines into /etc/rc.local to start fetchmail working in daemon mode when the server boots up.
/etc/rc.local: su tim -c "/usr/bin/fetchmail -d 900" su user2 -c "/usr/bin/fetchmail -d 1200" su user3 -c "/usr/bin/fetchmail -d 1500"
I picked different poll intervals to spread the load out. If you use prime numbers, you're quite unlikely to have multiple polls at the same time.
~/.fetchmailrc: poll example.com proto pop3 user "postmaster@example.com" with password "gvkhierughcjkc", is "tim" here; poll example.com proto pop3 user "webmaster@example.com" with password "asdfjht4hxfdy798342", is "tim" here;
The .fetchmailrc file has a rather nice way of letting you fill in details with almost human syntax, and is flexible in letting you specify it in different ways.
If a user requires their mail to be fetched immediately, they can type "fetchmail" into a command line, and it'll get mail now, and go back to polled intervals, automatically, afterwards.
Lewis NH2 wrote:
Good Evening,
I have a SOHO, and I like to access/answer my emails from every workstations. Of course everything should be kept up-to-sync. Furthermore, I'd like to avoid storing all emails on my ISP. Having a local IMAP server and fetching automatically the emails from my ISP sounds quite promising at first glance.
I plan to go for fetchmail to retrieve the email from the ISP and dovecot to provide the local IMAP server. Now I am a bit unsure about the setup. As far as I can see, it seems that most solutions found on the net involves a 3rd agent, for instance procmail.
Is it possible to go only with fetchmail and dovecot? If I understood correctly, dovecot comes up with a LDA that can be directly evoked from fetchmail using the mda directive. Is this correct?
Yes, works fine.
Does someone have succeed in setting such configuration up?
Not only can you do this, but you can add sendmail if you want to receive mail directly for some reason. This allows P2P connections although some ISPs block access to port 25 on customer machines.
As I am a noob regarding emails servers technology, any help, advice, pointers would be greatly appreciated.
Pointer: by doing this you mail is totally in your hands and only as safe as your backup. It is no longer on a professionally managed IMAP server run by your ISP. Depending on the value of the content you may want to consider your backup options. I won't discuss those options unless you ask another question. ;-)
TIA, Lew.
On Thu, 2011-05-26 at 19:11 -0400, Bill Davidsen wrote:
Pointer: by doing this you mail is totally in your hands and only as safe as your backup. It is no longer on a professionally managed IMAP server run by your ISP.
Or, no longer on a professionally mis-managed server...
Lewis NH2 wrote:
I plan to go for fetchmail to retrieve the email from the ISP and dovecot to provide the local IMAP server. Now I am a bit unsure about the setup. As far as I can see, it seems that most solutions found on the net involves a 3rd agent, for instance procmail.
Is it possible to go only with fetchmail and dovecot? If I understood correctly, dovecot comes up with a LDA that can be directly evoked from fetchmail using the mda directive. Is this correct?
Does someone have succeed in setting such configuration up?
I do precisely this (if I understand you correctly).
1. I run dovecot on my CentOS home server. The changes I've made to /etc/dovecot.conf are: --------------------------- #protocols = imap imaps pop3 pop3s protocols = imap imaps
#info_log_path = info_log_path = /var/log/dovecot
#ssl_listen = ssl_listen = *:993
#ssl_disable = no ssl_disable = no
#ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem #ssl_key_file = /etc/pki/dovecot/private/dovecot.pem ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem ssl_key_file = /etc/pki/dovecot/private/dovecot.pem
# mail_location = maildir:~/Maildir mail_location = maildir:~/Maildir mail_debug = yes
#mailbox_idle_check_interval = 30 mailbox_idle_check_interval = 30
#maildir_copy_with_hardlinks = no maildir_copy_with_hardlinks = yes
protocol imap {
listen = *:143 ssl_listen = *:993
---------------------------
[I created the ssl_cert and ssl_key files by running /usr/share/doc/dovecot-1.0.7/examples/mkcert.sh ]
2. I collect email on the server from 5 sites with fetchmail. I have entries like /etc/cron.d/fetch.maths on the server --------------------------- 5,15,25,35,45,55 * * * * tim /usr/bin/fetchmail -s pop.maths.tcd.ie ---------------------------
3. I have a stanza in .fetchmailrc for each site like --------------------------- poll pop.gmail.com proto POP3 port 995 user "***" password "***" ssl --------------------------- (The stanzas differ slightly for some sites, and required a little experimentation.)
Nb I'm no dovecot guru. If anyone can suggest improvements on the above I shall be grateful.
On Fri, 2011-05-27 at 12:43 +0100, Timothy Murphy wrote:
- I collect email on the server from 5 sites with fetchmail.
I have entries like /etc/cron.d/fetch.maths on the server
5,15,25,35,45,55 * * * * tim /usr/bin/fetchmail -s pop.maths.tcd.ie
Fetchmail can run as a daemon, all by itself.
Tim wrote:
Fetchmail can run as a daemon, all by itself.
Thanks for the suggestion. Will this work OK if I'm collecting mail from several sites? At present I've set the cron scripts to run at different times.
I think I occasionally get error messages that fetchmail has failed to collect mail from one site because it is still collecting from another site?
Hi All,
thanks so far for all worthy information provided so far.
I personally agree to leave such tasks to professionals, as long as you can afford their services and those meet your requirements. IMHO, you should always consider this possibility before embarking on some 'home brew solution'.
In my case, I am learning new stuff (like set-up a IMAP server), and evaluating what's possible...
I am now able to fetch the mails and store them in a maildir structure. Now I am trying to connect to my local dovecot IMAP server running on F14, but not avail. dovecot is running, the imap ports 143, 993 are listening:
$sudo netstat -atp | grep imap tcp 0 0 *:imaps *:* LISTEN 5982/dovecot tcp 0 0 *:imap *:* LISTEN 5982/dovecot tcp 0 0 *:imaps *:* LISTEN 5982/dovecot tcp 0 0 *:imap *:* LISTEN 5982/dovecot
When I try to telnet imap port on a client machine, I'm getting: $ telnet 192.168.0.150 143 Trying 192.168.0.150... telnet: Unable to connect to remote host: No route to host
But a tcpdump on the IMAP server reveals that the TCP packet is arriving at the interface: $sudo tcpdump -i eth0 dst port 143 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 16:46:29.029730 IP 192.168.0.107.49721 > 192.168.0.150.imap: Flags [S], seq 1571763932, win 5840, options [mss 1460,sackOK,TS val 912067 ecr 0,nop,wscale 7], length 0
Are there some security settings on F14 (firewall, SE linux...) that need to be weakened?
TIA, Lew
On 05/27/2011 06:59 PM, Timothy Murphy wrote:
Tim wrote:
Fetchmail can run as a daemon, all by itself.
Thanks for the suggestion. Will this work OK if I'm collecting mail from several sites? At present I've set the cron scripts to run at different times.
I think I occasionally get error messages that fetchmail has failed to collect mail from one site because it is still collecting from another site?
You can tell fetchmail to poll at specific intervals. This prevents the error you sometimes see, because fetchmail already knows it is downloading from that site. You could run more then one copy of fetchmail in the daemon mode - one for each user.
You can have one config file that specifies the sites to collect from, the order to poll them for new messages, and how to collect from each site. If you have more then one account to collect from a site, you can control that as well.
You may want to read the fetchmail man page, as well as the other documentation.
Mikkel
Tim:
Fetchmail can run as a daemon, all by itself.
Timothy Murphy:
Thanks for the suggestion. Will this work OK if I'm collecting mail from several sites? At present I've set the cron scripts to run at different times.
Mine does. My .fetchmailrc file has the details for several different mailservices. Fetchmail runs as a background task and wakes up every X seconds, stepping through the .fetchmailrc file one server at a time.
I posted an example of how it's set up a few days ago, in this thread.
NB: Don't set the interval too short. Service providers may start blocking access for over-use. Or, another problem can be that your fetchmail run might not finish completing before you ask it to do the next run. I set mine for about 9 minute intervals.
I think I occasionally get error messages that fetchmail has failed to collect mail from one site because it is still collecting from another site?
Sounds about right.