Getmail with Kolab2
From Kolab wiki
This can be used to download mail from ISP-POP3 mailboxes and to deliver them to their respective Kolab users by using the getmail of your host distribution.
Installation
Step1: OpenPGK does not provide getmail4 so we have to install getmail from our host distribution or download the sources at http://pyropus.ca/software/getmail/.
Step2: Create a log directory for getmail within kolab and grant priviledges to user kolab
mkdir /kolab/var/getmail chmod 755 /kolab/var/getmail chown kolab:kolab /kolab/var/getmail
Step3: Normally we would create one .getmailrc for the user that contains the instructions to download the mails. For kolab downloads mails from different account (e.g. users) we have to create one getmail-file for each user that we place in a folder within kolab again.
mkdir /kolab/etc/getmail chmod 755 /kolab/etc/getmail chown kolab:kolab /kolab/etc/getmail
Step4: the configuration file we place into that folder as f.e. username1.conf could look like this:
| Note |
|---|
|
The options may differ depending on your ISP-POP-Account, please read the getmail documentation for more details. http://pyropus.ca/software/getmail/ |
[options]
message_log = /kolab/var/getmail/getmail.log ## one could give here a name to the logfile for each user to prevent flooding eg. getmail_user1.log
verbose = 2
delete = true ## if all mails should be deleted after getting, else set this to false
[retriever]
type=SimplePOP3Retriever
server=<pop.our_server.tld>
username=<our_pop_username>
password=<our_pop_passwd>
[destination]
type=MDA_external
path=/kolab/sbin/sendmail ## this will delegate the emails to kolab's-postfix
arguments=("-i","-bm","user@localmaildomain")
Step5: Creation of a script that reads all .conf files in /kolab/etc/getmail and download the mails from the ISP
touch getmail-all.sh ## I placed this one in siply in folder /kolab chmod 755 /kolab/getmail-all.sh chown kolab:kolab /kolab/getmail-all.sh
Open the file and write:
#!/bin/bash GM="/usr/bin/getmail -q" for ii in /kolab/etc/getmail/*.conf do $GM -g/kolab/var/getmail -r$ii done
Step6: create a cronjob that runs as user kolab on the getmail-all.sh.
Adds
- If you have many users, you could create a second or third /kolab/etc/getmailx folder, each with equal numbers of user.conf files and write different getmail-allx.sh files to split the load on your network and your ISP.
- You could add
delete_after=x read_all = false instead of delete = true
in the [options]-section of your .conf-file where x ist the number of days the messages shall stay on the ISP-POP-Server, to read mails from @home with your ISP's webmailer. Problem: all internal message is not send to the ISP so not seen from outside your network.
