[Dovecot] deliver rewrites envelop-sender
Hello,
we are currently using sendmail, procmail, uwimap and qpopper. We are planing to replace uwimap and qpopper with dovecot. Which seems to be a very good idea :-) But: Sendmail and Procmail will not be replaced.
Now I've realized that deliver rewrites existing "From <....> ..." header lines to ">From <...> ..." and adds it's own "From "-line.
Example:
My procmailrc end with :0 | deliver -d beckerr
Mails are deliver to my INBOX, but
- From beckerr@fh-trier.de Sun Jan 07 17:37:43 2007
- Received: ...
- From: ...
is rewritten to
- From MAILER-DAEMON Sun Jan 07 17:37:44 2007
From beckerr@fh-trier.de Sun Jan 07 17:37:43 2007
- Received: ...
- From: ...
Is there a (simple) way to prevent deliver from doing so?
OR
In case "-f <envelop sender>" is not given, could deliver
- read the envelop sender address from the "From <...>" line,
- remove the line and
- add it's own using the formally extracted sender address?
This sounds best for me and would cover the problem most effective...
BTW:
I've found the "dovecot deliver patch for procmail" and it looks really good (http://dovecot.org/pipermail/dovecot/2006-July/014656.html), but it seems to me, that the "From " line problem is solved by optionally removing the whole line, so deliver would use it's own default "From MAILER-DAEMON "-line ... and this in fact the problem
Regards, Ralf
--
Dipl.-Inform. (FH) Ralf Becker Rechenzentrum (r/ft) der FH Trier (Network|Mail|Web|Firewall) University of applied sciences Administrator Schneidershof, D-54293 Trier
Mail: beckerr@fh-trier.de Fon: +49 651 8103 499 WWW: http://www.fh-trier.de/~beckerr Fax: +49 651 8103 214 PGP: http://www.fh-trier.de/~beckerr/pgp ICQ: <available>
Wenn Gott gewollt haette, dass E-Mail in HTML geschrieben wuerden, endeten Gebete traditionell mit </amen>. (Tom Listen)
Hello!
I'm the author of the procmail patch for dovecot's deliver program.
You can specify -f <envelope sender> with dovecot deliver when I remember correctly.
DELIVER_PROGRAM="/usr/libexec/dovecot/deliver -m \$BOXNAME -d \$RECIPIENT -f SOMETHING_ELSE -c /etc/dovecot.conf" (Can't remember whether there was a variable for the from user or not, when yes you can specify the from user, too. ) When you need any help feel free to contact me.
BTW: The First from line is only the mbox delimiter and really has no effect on the Mail headers. I also have MAILER-DAEMON in the From line without any problems at all. So this is IHMO only cosmetic.
@Timo: Running /usr/libexec/dovecot/deliver (without any parameters waiting for stdin) and pressing Ctrl-C => Core dump with dovecot 1.0rc17.
Grüße aus Wien :-)
Ciao, Gerhard
On Sun, 7 Jan 2007, Ralf Becker wrote:
Hello,
we are currently using sendmail, procmail, uwimap and qpopper. We are planing to replace uwimap and qpopper with dovecot. Which seems to be a very good idea :-) But: Sendmail and Procmail will not be replaced.
Now I've realized that deliver rewrites existing "From <....> ..." header lines to ">From <...> ..." and adds it's own "From "-line.
Example:
My procmailrc end with :0 | deliver -d beckerr
Mails are deliver to my INBOX, but
- From beckerr@fh-trier.de Sun Jan 07 17:37:43 2007
- Received: ...
- From: ...
is rewritten to
- From MAILER-DAEMON Sun Jan 07 17:37:44 2007
From beckerr@fh-trier.de Sun Jan 07 17:37:43 2007
- Received: ...
- From: ...
Is there a (simple) way to prevent deliver from doing so?
OR
In case "-f <envelop sender>" is not given, could deliver
- read the envelop sender address from the "From <...>" line,
- remove the line and
- add it's own using the formally extracted sender address?
This sounds best for me and would cover the problem most effective...
BTW:
I've found the "dovecot deliver patch for procmail" and it looks really good (http://dovecot.org/pipermail/dovecot/2006-July/014656.html), but it seems to me, that the "From " line problem is solved by optionally removing the whole line, so deliver would use it's own default "From MAILER-DAEMON "-line ... and this in fact the problem
Regards, Ralf
--
Dipl.-Inform. (FH) Ralf Becker Rechenzentrum (r/ft) der FH Trier (Network|Mail|Web|Firewall) University of applied sciences Administrator Schneidershof, D-54293 Trier
Mail: beckerr@fh-trier.de Fon: +49 651 8103 499 WWW: http://www.fh-trier.de/~beckerr Fax: +49 651 8103 214 PGP: http://www.fh-trier.de/~beckerr/pgp ICQ: <available>
Wenn Gott gewollt haette, dass E-Mail in HTML geschrieben wuerden, endeten Gebete traditionell mit </amen>. (Tom Listen)
Hello Gerhard,
thanks for the fast reply.
I've patched procmail (it's working great) and for now, I'm using this configuration:
/etc/procmailrc
DELIVER_INBOX=yes DELIVER_REPLACE_INBOX_NAME=yes DELIVER_NEW_INBOX_NAME=INBOX DELIVER_ABSOLUTE_PATH=yes DELIVER_PIPE_NO_LOCK=yes DELIVER_RAW_MODE=yes DELIVER_REMOVE_FROM=yes DELIVER_PROGRAM="/usr/bin/deliver -m \$BOXNAME -f \$ENVELOP_SENDER -d \$RECIPIENT"
:0
- ^From \/[^ ]* { ENVELOP_SENDER=$MATCH } ENVELOP_SENDER=${ENVELOP_SENDER:-MAILER-DAEMON@fh-trier.de}
.procmailrc
:0
- ^X\-RFT\-FORWARD: beckerr@fh\-trier\.de -> XXXX@YYY\.de { DELIVER_PROGRAM :0 /dev/null } :0 Ec | formail -I 'X-RFT-FORWARD: beckerr@fh-trier.de -> XXXX@YYY.de' -s /usr/lib/sendmail -i XXXX@YYY.de
As you see I have to unset DELIVER_PROGRAM to discard looping messages by sending them to /dev/null. This is a little bit unhandy, because other users have to alter their .procmailrc too.
What do you think about defining an environment variable like DELIVER_SKIP_PATH=/dev:/tmp to set a number of paths for which (dovecot-)deliver is skipped and instead procmail is used to save the mail.
Regards, Ralf
PS: Gruß aus Trier, der ältesten Stadt Deutschlands :-)
Gerhard Wiesinger schrieb am 07.01.2007 21:07:
Hello!
I'm the author of the procmail patch for dovecot's deliver program.
You can specify -f <envelope sender> with dovecot deliver when I remember correctly.
DELIVER_PROGRAM="/usr/libexec/dovecot/deliver -m \$BOXNAME -d \$RECIPIENT -f SOMETHING_ELSE -c /etc/dovecot.conf" (Can't remember whether there was a variable for the from user or not, when yes you can specify the from user, too. ) When you need any help feel free to contact me.
BTW: The First from line is only the mbox delimiter and really has no effect on the Mail headers. I also have MAILER-DAEMON in the From line without any problems at all. So this is IHMO only cosmetic.
@Timo: Running /usr/libexec/dovecot/deliver (without any parameters waiting for stdin) and pressing Ctrl-C => Core dump with dovecot 1.0rc17.
Grüße aus Wien :-)
Ciao, Gerhard
--
Dipl.-Inform. (FH) Ralf Becker Rechenzentrum (r/ft) der FH Trier (Network|Mail|Web|Firewall) University of applied sciences Administrator Schneidershof, D-54293 Trier
Mail: beckerr@fh-trier.de Fon: +49 651 8103 499 WWW: http://www.fh-trier.de/~beckerr Fax: +49 651 8103 214 PGP: http://www.fh-trier.de/~beckerr/pgp ICQ: <available>
Wenn Gott gewollt haette, dass E-Mail in HTML geschrieben wuerden, endeten Gebete traditionell mit </amen>. (Tom Listen)
Hello!
Yes, DELIVER_SKIP_PATH would be a good idea. But I really wanted to avoid to use procmail at all.
BTW: What is your problem with the first FROM line, I really didn't unterstand the problem there?
Ciao, Gerhard
On Tue, 9 Jan 2007, Ralf Becker wrote:
Hello Gerhard,
thanks for the fast reply.
I've patched procmail (it's working great) and for now, I'm using this configuration:
/etc/procmailrc
DELIVER_INBOX=yes DELIVER_REPLACE_INBOX_NAME=yes DELIVER_NEW_INBOX_NAME=INBOX DELIVER_ABSOLUTE_PATH=yes DELIVER_PIPE_NO_LOCK=yes DELIVER_RAW_MODE=yes DELIVER_REMOVE_FROM=yes DELIVER_PROGRAM="/usr/bin/deliver -m \$BOXNAME -f \$ENVELOP_SENDER -d \$RECIPIENT"
:0
- ^From \/[^ ]* { ENVELOP_SENDER=$MATCH } ENVELOP_SENDER=${ENVELOP_SENDER:-MAILER-DAEMON@fh-trier.de}
.procmailrc
:0
- ^X\-RFT\-FORWARD: beckerr@fh\-trier\.de -> XXXX@YYY\.de { DELIVER_PROGRAM :0 /dev/null } :0 Ec | formail -I 'X-RFT-FORWARD: beckerr@fh-trier.de -> XXXX@YYY.de' -s /usr/lib/sendmail -i XXXX@YYY.de
As you see I have to unset DELIVER_PROGRAM to discard looping messages by sending them to /dev/null. This is a little bit unhandy, because other users have to alter their .procmailrc too.
What do you think about defining an environment variable like DELIVER_SKIP_PATH=/dev:/tmp to set a number of paths for which (dovecot-)deliver is skipped and instead procmail is used to save the mail.
Regards, Ralf
PS: Gruß aus Trier, der ältesten Stadt Deutschlands :-)
Gerhard Wiesinger schrieb am 07.01.2007 21:07:
Hello!
I'm the author of the procmail patch for dovecot's deliver program.
You can specify -f <envelope sender> with dovecot deliver when I remember correctly.
DELIVER_PROGRAM="/usr/libexec/dovecot/deliver -m \$BOXNAME -d \$RECIPIENT -f SOMETHING_ELSE -c /etc/dovecot.conf" (Can't remember whether there was a variable for the from user or not, when yes you can specify the from user, too. ) When you need any help feel free to contact me.
BTW: The First from line is only the mbox delimiter and really has no effect on the Mail headers. I also have MAILER-DAEMON in the From line without any problems at all. So this is IHMO only cosmetic.
@Timo: Running /usr/libexec/dovecot/deliver (without any parameters waiting for stdin) and pressing Ctrl-C => Core dump with dovecot 1.0rc17.
Grüße aus Wien :-)
Ciao, Gerhard
--
Dipl.-Inform. (FH) Ralf Becker Rechenzentrum (r/ft) der FH Trier (Network|Mail|Web|Firewall) University of applied sciences Administrator Schneidershof, D-54293 Trier
Mail: beckerr@fh-trier.de Fon: +49 651 8103 499 WWW: http://www.fh-trier.de/~beckerr Fax: +49 651 8103 214 PGP: http://www.fh-trier.de/~beckerr/pgp ICQ: <available>
Wenn Gott gewollt haette, dass E-Mail in HTML geschrieben wuerden, endeten Gebete traditionell mit </amen>. (Tom Listen)
Hello Gerhard,
it is maybe a little bit haarsplitting that I'm insisting to find the original envelop sender in the "From " line (= FROM_ line). But in my opinion this is part of the mbox format definition.
[http://www.qmail.org/man/man5/mbox.html]
The From_ line always looks like From envsender date moreinfo. envsender is one word, without spaces or tabs; it is usually the envelope sender of the message.
and
HOW A MESSAGE IS DELIVERED Here is how a program appends a message to an mbox file. It first creates a From_ line given the message's envelope sender and the current date. If the envelope sender is empty (i.e., if this is a bounce message), the program uses MAILER-DAEMON instead. If the envelope sender contains spaces, tabs, or newlines, the program replaces them with hyphens.
Dovecot uses mboxcl2, which basically handles the "From " line like mboxo (=mbox?)
Indeed it's not a bug to ignore the envelop sender and use "From MAIL-DEAMON ..." when delivering. But in this case deliver should add Return-Path: <envelop-sender> if not already present
Think about bouncing a already delivered message:
This mail can be bounced From beckerr@fh-trier.de Thu Dec 1 05:12:01 2005 From: some-list some-list@list-home.org To: some-list some-list@list-home.org Subject: test
This message too From MAILER-DAEMON Thu Dec 1 05:12:01 2005 Return-Path: beckerr@fh-trier.de From: some-list some-list@list-home.org To: some-list some-list@list-home.org Subject: test
But this message can not be bounced, because the envelop sender is unknown: From MAILER-DAEMON Thu Dec 1 05:12:01 2005 From: some-list some-list@list-home.org To: some-list some-list@list-home.org Subject: test
ok... actually this messages could be bounced to, but would be bounced to the mailing list, which is a bad idea :-)
And something completely different:
I've implemented DELIVER_SKIP_PATH testing. I don't want to publish a patch for a patch. Do you want to put the new patch on your homepage or should I but it on mine?
This is what I've added:
[src/mailfold.c @216] int isinbox = 0; if (s_org_mail) isinbox = !strcmp(s_org_mail, boxname);
// rb - start if (trydeliver && program) { char *skip_path = getenv("DELIVER_SKIP_PATH"); if (skip_path) { char *i=skip_path; while (*i) { char *j, *k;
for (j=i; *j && *j!=':'; j++)
;
k=j;
for (k=j; k>i && k[-1]=='/'; k--)
;
if (i!=k && strncmp(boxname,i,k-i)==0 && (boxname[k-i]=='/'
|| !boxname[k-i])) { yell("skipping delivering through external program for ", boxname); program = NULL; break; } if (!*j) break; i=j+1; } } } // rb - end if (trydeliver && program && ((!isinbox && !isabsolute) || (isinbox && deliver_inbox) || (isabsolute && deliver_absolute_path)) ) {
Bye, Ralf
Gerhard Wiesinger schrieb am 09.01.2007 18:37:
Hello!
Yes, DELIVER_SKIP_PATH would be a good idea. But I really wanted to avoid to use procmail at all.
BTW: What is your problem with the first FROM line, I really didn't unterstand the problem there?
Ciao, Gerhard
--
Dipl.-Inform. (FH) Ralf Becker Rechenzentrum (r/ft) der FH Trier (Network|Mail|Web|Firewall) University of applied sciences Administrator Schneidershof, D-54293 Trier
Mail: beckerr@fh-trier.de Fon: +49 651 8103 499 WWW: http://www.fh-trier.de/~beckerr Fax: +49 651 8103 214 PGP: http://www.fh-trier.de/~beckerr/pgp ICQ: <available>
Wenn Gott gewollt haette, dass E-Mail in HTML geschrieben wuerden, endeten Gebete traditionell mit </amen>. (Tom Listen)
participants (2)
-
Gerhard Wiesinger
-
Ralf Becker