Fetchmail to Zarafa

From Zarafa wiki

Jump to: navigation, search

fetchmail collection to Zarafa Mailboxes:

There are a few tools out there that will collect emails from External POP3 servers and deliver them to a local Zarafa server. One of them that is by far the easiest to use is fetchmail.

The following will take you through the configuration needed to use fetchmail with Zarafa.

Firstly, we need to create the 'fetchmailrc' file. This file contains the configuration parameters, usernames,passwords and what servers to download the mail from.


   set daemon 60
           proto pop3
   poll [email protected]
           via mail.domain.com.au
           user "[email protected]"
           pass "password"
           mda "/usr/bin/zarafa-dagent user"
           no ssl

There are a number of other parameters you can use, find more here: Redhat Fetchmail Commands

Then you repeat the 'poll' section to 'no ssl' for each user. Obviously changing the details.

Next create a file called: /etc/cron.domain/fetchmail.sh and add the following to that file: (This file will be called via crontab to initiate the fetchmail collection every 5 minutes or what ever you specify.)


   # Add this to a cron process that runs once every 15 mins
   # just to make sure fetchmail is up and running
   fetchmailpid=`/sbin/pidof fetchmail`
   # If fetchmail is not running then start it
   if [ $? -ne 0 ]; then
     /usr/bin/fetchmail -F -K -L /var/log/fetchmail
  • Please note: The '-K' option above will delete retrieved messages from the remote mailserver. If you want to keep the emails on the external POP3 server, then i would suggest removing the '-K'.

Parameter Breakdown from above:

   -K - Delete retrieved messages from the remote mailserver. This option forces retrieved mail to be deleted
   -L - Specify the log file to which fetchmail should log to
   -F - Delete old (previously retrieved) messages from the mailserver before retrieving new messages

Set the permissions on the /etc/cron.domain/fetchmail.sh to 777:

   chmod 777 /etc/cron.domain/fetchmail

Now we setup the cron to collect the mail every 5 minutes:

   */5 * * * * /etc/cron.domain/fetchmail.sh

If there any errors check the /var/log/fetchmail.log for more information.

Personal tools