• # fetchmail + procmail + sendmail + cron

    Posté par . En réponse au message Rediriger mes mails vers un autre compte. Évalué à 3.

    Salut,

    J'en ai bavé un peu pour faire à peu près la même chose, voila mes fichiers de conf à toi d'adapter, c'est pas trop commenté mais déjà ça peut t'aider.
    Je redirige les emails envoyés à pop1@free.fr vers dest2@free.fr et dest1@libertysurf.fr ; mon nom de compte est toto mon domaine est hd.free.fr

    le fichier ~/.fetcmailrc: (je me suis aidé de fecthmailconf)

    # Configuration created Sun Dec 17 23:38:24 2006 by fetchmailconf 1.52 $Revision: 4740 $
    set postmaster "postmaster"
    set bouncemail
    set no spambounce
    set properties ""
    poll pop3.free.fr via pop3.free.fr
    with proto POP3 auth password and options no dns
    localdomains hd.free.fr localhost
    user 'pop1@free.fr' there with password '******' is 'toto' here options stripcr dropstatus dropdelivered


    le fichier ~/.procmailrc

    SHELL=/bin/sh #Use the Bourne shell (check your path!)
    MAILDIR=${HOME}/data/mails
    #First check what your mail directory is!
    LOGFILE=${MAILDIR}/procmail.log
    LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "
    #VERBOSE=y
    #redirection ****@free.fr
    :0
    * ^TO_pop1@free\.fr
    {
    :0 c
    ! dest1@libertysurf.fr
    :0
    ! dest2@free.fr
    }
    # Accept all the rest to your default mailbox
    :0:
    ${DEFAULT}


    le fichier .forward

    "|IFS=' ' && exec /usr/bin/procmail || exit 75 #toto"


    Et une tache crontab toutes les 10 minutes:

    */10 * * * * fetchmail -s