Procmail : probleme avec une redirection

Fermé
Alcorak Messages postés 3 Date d'inscription vendredi 14 août 2009 Statut Membre Dernière intervention 18 août 2009 - 14 août 2009 à 10:36
Alcorak Messages postés 3 Date d'inscription vendredi 14 août 2009 Statut Membre Dernière intervention 18 août 2009 - 18 août 2009 à 22:47
Bonjour,

j'ai un petit soucis avec un serveur de mail.

Je vous expose mon problème :

afin de rediriger des emails dont les destinataires sont en Bcc (ou Cci), j'utilise une recette dans procmail afin de trouver le destinataire du message dans le champ "Received:"

Voici la recette que j'utilise :
:0
* ^Received: .*for toto.tutu@totoland.com
! toto.tutu


Si j'ai bien un "match on" pour toto.tutu@totoland.com, là où ça ne va plus du tout c'est au moment de la redirection.
En effet, toto.tutu ne reçois pas le mail envoyer mais un mail d'erreur de ce genre :
Sujet: Undelivered Mail Returned to Sender

This is the mail system at host mailserver.totoland.com.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<toto.tutu@totoland.com>: mail forwarding loop for
    toto.tutu@totoland.com


Ce que je ne comprend pas c'est que la recette je l'ai vu sur des centaines de forums et sur chacun d'eux tout le monde s'accorde à dire que ça fonctionne impeccable, pourquoi pas chez moi ?

J'ai essayé plusieurs combinaison possible ainsi que sendmail mais j'ai toujours le même problème. La seule amélioration que j'ai eu a été lorsqu'à la place de ":0" j'ai mis ":0 c". A ce moment je recevai et le mail d'erreur et le mail normal.

Si quelqu'un à la moindre idée je suis preneur !

Voici mon procmailrc :
*# Preliminaires
SHELL=/bin/bash
MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
ORGMAIL=$MAILDIR
LOCKFILE=$HOME/lockfile.lock
ASSASSINLOCK=$HOME/assassin.lock
DEFAULT=$HOME/Maildir/
JUNKMAIL=$HOME/Maildir/.junkmail/
TRASH=$HOME/Maildir/.Trash
NEWBIE=$HOME/Maildir/.LinuxNewbie/
EXPERT=$HOME/Maildir/.LinuxExpert/
VIRUS=$HOME/Maildir/.virus/
BITBUCKET=/dev/null
LOGFILE=/var/log/procmailrc.log
VERBOSE=yes
LOGABSTRACT=all

#liste de diffusion redistribution
:0
* ^Received: .*for toto.tutu@totoland.com
! toto.tutu


et le log de procmail après réception d'un mail :
procmail: [29416] Thu Aug 13 22:05:08 2009
procmail: Assigning "LOGABSTRACT=all"
procmail: Match on "^.*for.*toto.tutu@totoland.com"
procmail: Assigning "LASTFOLDER=/usr/sbin/sendmail -oi toto.tutu@totoland.com"
procmail: Executing "/usr/sbin/sendmail,-oi,toto.tutu@totoland.com"
procmail: Notified comsat: "postmaster@:/usr/sbin/sendmail -oi toto.tutu@totoland.com"
From postmaster@totoland.com  Thu Aug 13 22:05:08 2009
 Subject: OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
  Folder: /usr/sbin/sendmail -oi toto.tutu@totoland.com              3030
procmail: Unlocking "/home/postmaster/lockfile.lock"
sendmail: warning: the Postfix sendmail command has set-uid root file permissions
sendmail: warning: or the command is run from a set-uid root process
sendmail: warning: the Postfix sendmail command must be installed without set-uid root file permissions
procmail: [29427] Thu Aug 13 22:05:11 2009
procmail: Assigning "LOGABSTRACT=all"
procmail: Match on "^.*for.*toto.tutu@totoland.com"
procmail: Assigning "LASTFOLDER=/usr/sbin/sendmail -oi toto.tutu@totoland.com"
procmail: Executing "/usr/sbin/sendmail,-oi,toto.tutu@totoland.com"
procmail: Notified comsat: "toto.tutu@:/usr/sbin/sendmail -oi toto.tutu@totoland.com"
From postmaster@totoland.com  Thu Aug 13 22:05:11 2009
 Subject: OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
  Folder: /usr/sbin/sendmail -oi toto.tutu@totoland.com              4061
procmail: Unlocking "/home/toto.tutu/lockfile.lock"
sendmail: warning: the Postfix sendmail command has set-uid root file permissions
sendmail: warning: or the command is run from a set-uid root process
sendmail: warning: the Postfix sendmail command must be installed without set-uid root file permissions
procmail: [29434] Thu Aug 13 22:05:12 2009
procmail: Assigning "LOGABSTRACT=all"
procmail: No match on "^.*for.*toto.tutu@totoland.com"
procmail: Assigning "PATH=/home/toto.tutu/bin:/usr/local/bin:/usr/bin:/bin"
procmail: Assigning "LASTFOLDER=/home/toto.tutu/Maildir/new/1250237112.29434_1.atpmail"
procmail: Notified comsat: "toto.tutu@0:/home/toto.tutu/Maildir/new/1250237112.29434_1.atpmail"
From MAILER-DAEMON  Thu Aug 13 22:05:12 2009
 Subject: Undelivered Mail Returned to Sender
  Folder: /home/toto.tutu/Maildir/new/1250237112.29434_1.atpmail        6954
procmail: Unlocking "/home/toto.tutu/lockfile.lock"


Merci d'avance pour votre aide

3 réponses

dubcek Messages postés 18765 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 20 février 2025 5 625
14 août 2009 à 10:50
hello
n'y a-t-il pas un problème de boucle infinie, parce que le mail de toto est renvoyé à toto ?
<toto.tutu@totoland.com>: mail forwarding loop for
toto.tutu@totoland.com
0
Alcorak Messages postés 3 Date d'inscription vendredi 14 août 2009 Statut Membre Dernière intervention 18 août 2009
14 août 2009 à 20:25
Salut,

oui c'est bien là mon problème !

Normalement une fois que procmail à matcher la partie "for" de l'en-tête "Received" il est censé déposer l'email dans la boite de "toto.tutu" du moins c'est ce que j'ai lu sur TOUS les forums et TOUS les tutos que j'ai consulté. Pas un seul ne parle d'un problème de boucle infinie, or c'est vrai que si on suit la logique de la recette la boucle infinie est plus que probable.
0
dubcek Messages postés 18765 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 20 février 2025 5 625
15 août 2009 à 08:27
mais quel est l'interêt et le but de vouloir renvoyer les mails de tutu à tutu ? c'est normal que ça boucle.
procmail permet, par exemple, d'envoyer les mails de tutu à tata, de copier dans un dosser les mails qui viennent de xxx ou dont le sujet est zzz, etc
0
Alcorak Messages postés 3 Date d'inscription vendredi 14 août 2009 Statut Membre Dernière intervention 18 août 2009
18 août 2009 à 22:47
Désolé pour la réponse tardive...

Je pense que j'ai dû mal m'exprimer.

Certains mails que je reçois ont tous leur destinataires en copie cachée, de ce fait, dans l'en-tête "To" apparait quelque chose comme "Undisclosed recipient" et le mail partait pour le postmaster (boite par défaut) au lieu du véritable destinataire.
Pour pouvoir remettre le mail à la bonne personne j'ai créé une recette qui oblige procmail a rechercher une chaîne de caractères dans l'en-tête "Received" (en l'occurrence l'adresse du destinataire) et de l'envoyer dans sa boite.

Voilà un exemple d'en-tête Received dans laquelle je cherche l'adresse du destinataire :

Received: from web27456.mail.ukl.yahoo.com (web27456.mail.ukl.yahoo.com
[255.146.255.52]) by mx1.free.fr (MOS 4.1.6-GA) with SMTP id BOV45811
for toto.tutu@totoland.com; Mon, 17 Aug 2009 23:38:41 -1000

Donc avec ma recette, procmail recherche "for toto.tutu.totoland.com" et si il trouve envois le mail a "toto.tutu".
Le soucis si je comprend bien, c'est que procmail refait faire au mail le circuit, donc il passe de nouveau dans procmail qui retrouve la chaine de caractères, le renvoi, et le refait passer dans le circuit... etc
0