This is an old version of the document!
benno-pop3 ist ein POP3 Konnektor für Benno MailArchiv. Die E-Mails werden aus einem Postfach eines POP3-Servers abgeholt und atomar in das INBOX-Verzeichnis von Benno geschrieben. Das Programm kann wird über das Paket benno-pop3 mittels apt installiert:
apt install benno-pop3
In der Datei /etc/benno-pop3/benno-pop3.conf werden der Hostname sowie die Zugangsdaten für das Postfach eingetragen.
# # benno-pop3.conf # # user = # pass = # host = localhost # port = 110 | 995 # runuser = benno # numfetch = 200 # inbox = /srv/benno/inbox # # extraheader_name = X-BENNO-GW # extraheader_value = host = pop3.lw-systems.net user = mailimport pass = secret
Danach wird der Cron-Job in der Datei /etc/cron.d/benno-pop3 aktiviert. Hierfür wird das # Zeichen vor der Zeile mit dem Programmaufruf entfernt.
Achtung! Die E-Mails werden nach Abholung direkt gelöscht!
# /etc/cron.d/benno-pop3 # # */15 * * * * benno [ -x /usr/sbin/benno-pop3 ] && /usr/sbin/benno-pop3 -c /etc/benno-pop3/benno-pop3.conf -d -s -S
Call: benno-pop3 [-D] [-c<file> ] [-A<mode> ] [-u<user> ] [-p<pass> ] [-i<inbox dir> ] [-H<host> ] [-n<num> ] [-s] [-S] -D print debug messages -c<file> path to config file (format: param = value) -u<user> pop3 username -p<pass> pop3 password -i<dir> Benno inbox (/srv/benno/inbox) -H<host> hostname (localhost) -M<mode> file mode (default 0640) -P<port> port (110) -R<userid> run as<userid> (default benno) -n<num> fetch num mails per run (200) -d delete mails on pop3 server -r<addr> add address as X-REAL-RCPTTO header -s ssl connect to pop3s (default port 995) -S suppress ssl certificate verification -A<mode> AUTH MODE: BEST (default) | PASS | APOP | CRAM-MD5 -X extra header name written to each mail (default: X-BENNO-GW) -x extra header value written to each mail (setting enables) -v verbose
When retrieving large mailboxes, a problem can occur where the import job is not yet finished when the next run starts. Depending on the POP3 server configuration, the emails may not yet be deleted, so the next run attempts to load the entire mailbox again. This can overload the POP3 server.
For this reason, the program is designed so that only one job can run at a time.
Für den Abruf mehrerer Mailboxen bietet sich ein serieller Abruf an. Hierfür wird ein kleines Script /etc/benno-pop3/fetch-serial erstellt, das die möglichen Konfigurationen der Reihe nach abarbeitet:
#!/bin/bash # # /etc/benno-pop3/fetch-serial CONFDIR=/etc/benno-pop3/ ENABLED='' for CONFFILE in $(ls -1 ${CONFDIR}/*.conf); do /usr/sbin/benno-pop3 -c "${CONFFILE}" -s -S -d ENABLED=OK done [ ${ENABLED}x = x ] && echo "BENNO POP3 ERROR - No configuration enabled" && exit 1
This script calls all configuration files with the extension .conf from the directory one after the other.
Then activate the x-flag:
chmod +x /etc/benno-pop3/fetch-serial
and adjust the cron call:
*/15 * * * * benno [ -x /etc/benno-pop3/fetch-serial ] && /etc/benno-pop3/fetch-serial