Linux - mini-HOWTO - fetchmail


Fetchmail - E-Mail's beim Provider abholen

Installation Fedora Core / Red Hat

Paket installieren, falls nicht schon geschehen.

[root@hammer]# rpm -ihv fetchmail-6.2.5-2.i386.rpm


Konfiguration - z. B. /root/.fetchmailrc

# ----------------------------------------------------
# /root/.fetchmailrc - Start
# ----------------------------------------------------
#
set postmaster postmaster@example.com
# -- Adresse für Berichte etc. von Fetchmail. --

set daemon 600
# -- Fetchmail im Hintergrund laufen lassen und alle 10 Min. nach E-Mail's sehen. --

set syslog
# -- Fetchmail schreibt in /var/log/maillog --

# set logfile /var/log/fetchmail
# -- Alternativ, eigene Logdatei für Fetchmail. --

poll pop.example.com
# -- Email Server des Providers. --

  proto pop3
  # -- Protokoll pop3 oder imap. --

  no dns
  # -- Keine DNS Auflösung

  user "test"
  # -- Benutzername für das E-Mail Konto --

  pass "Passwort"
  # -- Passwort für das E-Mail Konto --

  is test
  # -- Lokaler Benutzername. --

  smtpaddress "example.com"
  # -- Eigene Domain, falls der Mail Server vom localhost keine E-Mail's habe möchte. --

  # keep
  # -- Wenn die E-Mail's auf dem Server nicht gelöscht werden sollen. --

poll pop.example.com
# -- Email Server des Providers für die 2. E-Mail usw. --
...
...

Mehr Optionen gibt es in man fetchmail

# ----------------------------------------------------
# /root/.fetchmail - Ende
# ----------------------------------------------------

Startskript - /etc/rc.d/init.d/fetchmail

# ----------------------------------------------------
# /etc/rc.d/init.d/fetchmail - Start
# ----------------------------------------------------
#
#! /bin/bash
#
# chkconfig: 2345 80 30
# description: Fetchmail - fetch mail from a POP, IMAP, ETRN, or ODMR-capable server.
#
# Source function library.
. /etc/rc.d/init.d/functions

prog="/usr/bin/fetchmail"
prog_base="$(basename ${prog})"

RETVAL=0

case "$1" in
    start)
      action $"Starte ${prog_base}:" ${prog} -f /root/.fetchmailrc -i /root/.fetchids
      RETVAL=$?
      [ $RETVAL -eq 0 ] && touch /var/lock/subsys/${prog_base}
      echo
      ;;
    stop)
      action $"Beende ${prog_base}:" ${prog} -quit
      RETVAL=$?
      if [ $RETVAL -eq 0 ] ; then
       echo "${prog_base} beendet."
       rm -f /var/lock/subsys/${prog_base}
      else
       echo
      fi
      ;;
     restart)
       $0 stop
       sleep 1
       $0 start
       RETVAL=$?
       ;;
     *)
       echo "Benutzung: $0 {start|stop|restart}"
       exit 1
esac

exit 0

# ----------------------------------------------------
# /etc/rc.d/init.d/fetchmail - Ende
# ----------------------------------------------------

Fetchmail Daemon starten

[root@hammer]# /sbin/service fetchmail start

Starten des Fetchmail Daemons bei nächstem Systemstart aktivieren.

[root@hammer]# /sbin/chkconfig --add fetchmail

Mehr Informationen finden Sie unter [ http://catb.org/~esr/fetchmail/ ]

19.09.2004 © Edy Corak