Comment faire pour distinguer de quel compte provient un mail si on utilise [[http://catb.org/~esr/fetchmail/|fetchmail]] pour relever plusieurs comptes :
* [[http://www-inf.int-evry.fr/~olberger/oldblog/040629.html|Olivier Berger]] propose dans son blog du 29/06/2004 d'utiliser l'option ''tracepolls'' de [[http://catb.org/~esr/fetchmail/|fetchmail]] :\\
> If you use fetchmail with multiple mail sources / accounts polled, it may be handful to distinguish between these different sources for filtering in your email reader.
> To do this, you may use fetchmail's option "tracepolls" like in :
>
poll imap.provider.domain with proto IMAP and options tracepolls
user 'mailaccount' there is 'you' here ssl
> It then adds a header of the form :
>
> Received: from fetchmail.provider.domain [192.168.0.1]
by localhost with IMAP (fetchmail-5.9.11 polling imap.provider.domain account mailaccount)
for you@localhost (single-drop); Tue, 29 Jun 2004 14:25:49 +0200 (CEST)
> You may then filter it with procmail/formail in order to add a specific header that your email reader will be able to identify more easily. For example, you may add a "X-fetchmailtracepoll" header. Excerpt from .procmailrc :
>
:0fhw
* ^received: .*fetchmail-.* polling imap.provider.domain account mailaccount
| formail -I "X-fetchmailtracepoll: provider"
> Then all you have to do is declare a filter on the "X-fetchmailtracepoll: provider" header in the mail client.
===== Mon cas =====
Avec ma conf, je veux filtrer directement au delivery avec sieve donc j'utilise bien la directive de fetchmail ''and options tracepolls''
et mon filtre sieve donne ça : require "fileinto";
if header :contains "received" ["polling pop.myaccount.tld account myaccount"] {
fileinto "myaccount-folder";
}