Thursday, March 17, 2016

fetchmail - fetch mail from a POP, IMAP server

fetchmail can retriev and forward. it fetches mail from  remote  mailservers  and  forwards  it  to  your  local mailserver or to your mail client machine's  delivery  system. 

*** example ***
remote server:  domain: mail.test
- user to fetch: user8 and user9

1- installation
$ sudo apt-get install fetchmail
$ sudo apt-get install procmail

2- configuration create file in /root/.fetchmailrc with the following contetn

set daemon 600  # fetch every 10 minute
poll test.mail proto pop3:
user "user8", with password "me" is user8 here;
user "user9", with password "me" is user9 here;

mda "/usr/bin/procmail-d %T";

3- run the fetchmail
root# chmod 700 /root/.fetchmailrc
root# fetchmail

show every 10 minutes it will connect to our remote server (test.mail) to retrieve emails of user8 and user9 to our local mailservers.

we also can use cron to do the periodical retrieval if we don't set daemon in fetchmail configartion

No comments:

Post a Comment