On Mon, 2007-12-03 at 11:02 +0100, Andre Huebner wrote:> i switched mailformat from mbox to maildir. Now i have a little
> problem with procmail/formail and headermanipulation of mails.
>
> Here an example:
>
> 0
> * ^From.*gmx.de
> | (formail -t -I"procmail: gmx.de") >>
/var/spool/mail/xxxxxx
I would never do it that way anyway. You are bluntly appending the mail
to the raw spool (or mbox file) without any locking. Instead, make
procmail deliver the mail properly, figuring out the correct locking
method.
> So, i can add some different headerlines for later evaluation and the
> result is attached to inbox.
^^^^^> Now i have the problem that i don't know name of targetfile, cause it
> is unique for every mail if maildir is used.
^^^^^^^
You made that example up, instead of copy-n-paste'ing real life procmail
receipts, right? Isn't the default system spool still an mbox file, even
when using Maildir?
Anyway, again -- let procmail figure out how to properly deliver the
mail. For Maildir storage, just use the directory name, including the
trailing slash. See 'man procmailrc'. Example below.
> I did not found a Option or other workaround to solve this case.
> I know, it is not a dovecot problem but i hope somebody can give a
> hint.
>
> Could it be a possibility to leave all unchanged? Mails could be
> transported to /var/spool/mail/xxxxxx and picked up by dovecot if in
> dovecot.conf the convert-plugin ist always activated?
No. At the very least you need to tell procmail you are using Maildir
instead if mbox for any delivery receipt.
Note: Example untested.
# Set the Maildir prefix, and have the Inbox in there, too.
MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
# Filter through formail, appending some custom header.
:0 fw
* ^From.*gmx.de
| formail -I "X-procmail: gmx.de"
# Keep mailing list traffic out of my Inbox. Let procmail care about
# proper locking.
:0 :
* ^List-Id: .+<dovecot.dovecot.org>
.mailing-lists.dovecot/
# Someone loves me. :) Whatever survived till this point will get
# delivered to the $DEFAULT Maildir.
Now, some words about that obscure tagging with formail. :)
Since you are using procmail with gmx.de (which does offer POP3 only for
free) I assume you are harvesting your mail using fetchmail.
Also, I assume the above example isn't actually what you use. It feels
rather useless to add a custom header for that. Your receipt above will
match on any From: header with a gmx.de substring, too. Which includes
the real name. Besides, you can directly evaluate that header anyway...
I guess you actually mean to tag all mail fetched from the gmx.de POP3
account. In that case, have a look at the fetchmail "tracepolls"
option.
It will add info like "polling $server account $user" to the procmail
generated Received: header. You can directly filter on that header using
procmail, instead of a custom added one. If this is your use case, the
tracepolls option is the only accurate method anyway. Short of using
dedicated local users. ;)
HTH
guenther
--
char *t="\10pse\0r\0dtu\0. at
ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8?
c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){
putchar(t[s]);h=m;s=0; }}}