User tools

Website tools


fetchmail

Fetchmail

POP3 & IMAP with fetchmail

Importing emails from a POP3 or IMAP mailbox can also be done using fetchmail.

In its default configuration, fetchmail delivers retrieved emails to localhost via SMTP. However, fetchmail can be configured to pass the emails directly to any program. With this configuration, the email can then be delivered to a mailbox in Maildir format.

From here, the email is imported into Benno.

Configuration of fetchmail and procmail

Fetchmail is called using the following configuration file and delivers the emails to a Maildir via procmail.

# /etc/benno/fetchmailrc
#
set invisible poll pop3server.lw-systems.net user "bennoarchive" password "secret" fetchall mda "/usr/bin/procmail -m /etc/benno/procmailrc"

The path to the Maildir directory is defined in the procmailrc file

# /etc/benno/procmailrc # MAILDIR=/srv/benno/inbox :0 new/

Die E-Mails werden jetzt in das Verzeichnis /srv/benno/inbox/new ausgeliefert. Nach Auslieferung werden alle E-Mails von hier in das Inbox-Verzeichnis gelinkt. Dieses sollte direkt im Aufruf-Script von fetchmail durchgeführt werden.

Calling fetchmail

The script benno-fetchmail must be called as user "benno".

#!/bin/sh
#
# Script: /usr/local/sbin/benno-fetchmail
#
/usr/bin/fetchmail -f /etc/benno/fetchmailrc
 
for MAILFILE in `ls -1 /srv/benno/inbox/new`; do
  /bin/ln "/srv/benno/inbox/new/${MAILFILE}" "/srv/benno/inbox/${MAILFILE}.eml" && /bin/rm "/srv/benno/inbox/new/${MAILFILE}"
done
fetchmail.txt Last modified: 2019/02/04 10:54 by lwsystems