Discussion:
sendmail and X-Envelope-From header
Dan O'Brien
2003-07-10 21:08:36 UTC
Permalink
Am I correct in my observation that SendMail, in its default
configuration, does *NOT* create the X-Envelope-From and X-Envelope-To
headers?

If so, how does one get SendMail to create them?

Thanks,
Dan O'Brien

______________________________________________________

Axon Solutions, Inc. Telephone: 703-845-8400
5827 Columbia Pike #502 Facsimile: 703-845-5568
Falls Church, VA 22041 www.axonsolutions.com
______________________________________________________

>From the Technology You Have to the Solutions You Need


-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Yorkshire Dave
2003-07-10 22:03:45 UTC
Permalink
On Thu, 2003-07-10 at 22:08, Dan O'Brien wrote:
> Am I correct in my observation that SendMail, in its default
> configuration, does *NOT* create the X-Envelope-From and X-Envelope-To
> headers?
>
> If so, how does one get SendMail to create them?
>
sendmail.cf

#########################
# Format of headers #
#########################

blah
blah

HX-Envelope-From: $g
HX-Envelope-To: $u

if i recall correctly :)

> Thanks,
> Dan O'Brien

--
Yorkshire Dave


--
Scanned by MailScanner at wot.no-ip.com



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Nix
2003-07-11 21:00:11 UTC
Permalink
On 10 Jul 2003, Yorkshire Dave said:
> HX-Envelope-From: $g
> HX-Envelope-To: $u

This adds the header even to mail that's being relayed on and not
locally delivered.

If you don't want that, something like

H?l?X-Envelope-Sender: $g

will do the trick.

--
`We cannot get a new line down the pipe due to a blockage and we cannot
dig up the road to clear the blockage because it is covered with the
wrong type of tarmac.' --- British Telecom, via Mark Lowes


-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Simon Byrnand
2003-07-10 22:29:13 UTC
Permalink
At 17:08 10/07/03 -0400, Dan O'Brien wrote:
>Am I correct in my observation that SendMail, in its default
>configuration, does *NOT* create the X-Envelope-From and X-Envelope-To
>headers?

No it doesn't.

However it does create a "Return-Path" header that is the same as what
would be in X-Envelope-From header, and SA knows to check the Return-Path
header. (For whitelist and blacklist etc)


>If so, how does one get SendMail to create them?

Ah, good question... no doubt there would be a way, but it probably
involves lots of arcane hacking of rules in sendmail.cf :)

Is there any special reason you need the Envelope-Recipient ? If you run SA
from the local delivery agent you already know who the recipient is when
procmail is called, if you run SA from a filter like Mimedefang then there
are potentially *multiple* recipients at the point the message is scanned
anyway...

Regards,
Simon



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Simon Byrnand
2003-07-10 23:03:52 UTC
Permalink
At 23:03 10/07/03 +0100, Yorkshire Dave wrote:
>On Thu, 2003-07-10 at 22:08, Dan O'Brien wrote:
> > Am I correct in my observation that SendMail, in its default
> > configuration, does *NOT* create the X-Envelope-From and X-Envelope-To
> > headers?
> >
> > If so, how does one get SendMail to create them?
> >
>sendmail.cf
>
>#########################
># Format of headers #
>#########################
>
>blah
>blah
>
>HX-Envelope-From: $g
>HX-Envelope-To: $u
>
>if i recall correctly :)

Looks plausable, as $g is in Return-Path, and $u is after 'for' in the
default header format, however as far as I know $u is only present if there
is ONE local recipient for the message. If there are multiple local
recipients of a message, it is not displayed...

Regards,
Simon



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Raul Dias
2003-07-11 00:19:56 UTC
Permalink
Em Qui, 2003-07-10 às 20:03, Simon Byrnand escreveu:

> >sendmail.cf
> >
> >#########################
> ># Format of headers #
> >#########################
> >
> >blah
> >blah
> >
> >HX-Envelope-From: $g
> >HX-Envelope-To: $u
> >
> >if i recall correctly :)
>
> Looks plausable, as $g is in Return-Path, and $u is after 'for' in the
> default header format, however as far as I know $u is only present if there
> is ONE local recipient for the message. If there are multiple local
> recipients of a message, it is not displayed...

Do you know how/what to use when there are multiple local
recipients instead of $u?

[]'s
Raul Dias




-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Simon Byrnand
2003-07-11 00:27:27 UTC
Permalink
At 21:19 10/07/03 -0300, Raul Dias wrote:
>Em Qui, 2003-07-10 às 20:03, Simon Byrnand escreveu:
>
> > >sendmail.cf
> > >
> > >#########################
> > ># Format of headers #
> > >#########################
> > >
> > >blah
> > >blah
> > >
> > >HX-Envelope-From: $g
> > >HX-Envelope-To: $u
> > >
> > >if i recall correctly :)
> >
> > Looks plausable, as $g is in Return-Path, and $u is after 'for' in the
> > default header format, however as far as I know $u is only present if
> there
> > is ONE local recipient for the message. If there are multiple local
> > recipients of a message, it is not displayed...
>
>Do you know how/what to use when there are multiple local
>recipients instead of $u?

Nope, no idea sorry. And I did try adding those headers on a test server to
see if it does work, and it does, $u actually puts <> around the email
address by itself and $g doesnt, so for them to look consistent, you want

HX-Envelope-From: <$g>
HX-Envelope-To: $u

I did also confirm that if the message has multiple local recipients that
the X-Envelope-To: line doesn't even get added at all :(

Regards,
Simon



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Yorkshire Dave
2003-07-11 19:07:27 UTC
Permalink
On Fri, 2003-07-11 at 01:27, Simon Byrnand wrote:
> At 21:19 10/07/03 -0300, Raul Dias wrote:
> >Em Qui, 2003-07-10 às 20:03, Simon Byrnand escreveu:
> >
> > > >sendmail.cf
> > > >
> > > >#########################
> > > ># Format of headers #
> > > >#########################
> > > >
> > > >blah
> > > >blah
> > > >
> > > >HX-Envelope-From: $g
> > > >HX-Envelope-To: $u
> > > >
> > > >if i recall correctly :)
> > >
> > > Looks plausable, as $g is in Return-Path, and $u is after 'for' in the
> > > default header format, however as far as I know $u is only present if
> > there
> > > is ONE local recipient for the message. If there are multiple local
> > > recipients of a message, it is not displayed...
> >
> >Do you know how/what to use when there are multiple local
> >recipients instead of $u?
>

As I understand it, $u is generated after the envelope has been
preprocessed (by ruleset 3?) and therefore only contains the current
recipient. Multiple recipients cause the message to be processed
differently and $u never exists. I don't know the way around this,
although I'm sure there is one. Either we need a real sendmail guru or
I'm going to get a headache figuring it out :)

> Nope, no idea sorry. And I did try adding those headers on a test server to
> see if it does work, and it does, $u actually puts <> around the email
> address by itself and $g doesnt, so for them to look consistent, you want
>
> HX-Envelope-From: <$g>
> HX-Envelope-To: $u
>
> I did also confirm that if the message has multiple local recipients that
> the X-Envelope-To: line doesn't even get added at all :(
>
> Regards,
> Simon
--
Yorkshire Dave


--
Scanned by MailScanner at wot.no-ip.com



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
David B Funk
2003-07-11 22:16:38 UTC
Permalink
On 11 Jul 2003, Yorkshire Dave wrote:

> On Fri, 2003-07-11 at 01:27, Simon Byrnand wrote:
> > At 21:19 10/07/03 -0300, Raul Dias wrote:
> > >Em Qui, 2003-07-10 =E0s 20:03, Simon Byrnand escreveu:
> > >
> > > > >sendmail.cf
[snip..]
> > > > >HX-Envelope-From: $g
> > > > >HX-Envelope-To: $u
> > > > >
> > > > >if i recall correctly :)
> > > >
> > > > Looks plausable, as $g is in Return-Path, and $u is after 'for' in =
the
> > > > default header format, however as far as I know $u is only present =
if
> > > there
> > > > is ONE local recipient for the message. If there are multiple local
> > > > recipients of a message, it is not displayed...
> > >
> > >Do you know how/what to use when there are multiple local
> > >recipients instead of $u?
>
> As I understand it, $u is generated after the envelope has been
> preprocessed (by ruleset 3?) and therefore only contains the current
> recipient. Multiple recipients cause the message to be processed
> differently and $u never exists. I don't know the way around this,
> although I'm sure there is one. Either we need a real sendmail guru or
> I'm going to get a headache figuring it out :)

At the risk of handing people a possibly "loaded gun", here's
how you make sendmail single threaded.
Set the option 'MaxRecipientsPerMessage' to 1

This will make sendmail accept only one recipient address for
each message. If a remote system wants to hand you a message
with multiple recipients, it will have to break the process up into
seperate tranactions for each recipient.

This -will- acheive your behaivor of only one local recipient for
each message (and thus have a $u value) but will mean that you will
have a seperate set of sendmail processes, set of SA processes,
queue files, network connections, etc for each recipient of any message.

If you regularly get messages with multiple recipients this -WILL-
increase the load on your server and use up more resources.

One other possible complication. If you have people using your
server as the SMTP server for their mail clients to send out messages
(IE it's the outgoing SMTP server for Mozilla, Eudora, Outlook, etc)
those people will get errors when ever they try to send a message with
more than one recipient. (Most mail clients don't know how to handle
a SMTP server that rejects more than one recipient per message).

So if you do want to do this, watch your server load and logs for
complications.

Here's how you do it, either edit the sendmail.cf file to add
the line:

O MaxRecipientsPerMessage=3D1

or edit your '.mc' file and add the line:

define(`confMAX_RCPTS_PER_MESSAGE',`1')dnl

--=20
Dave Funk University of Iowa
<dbfunk (at) engineering.uiowa.edu> College of Engineering
319/335-5751 FAX: 319/384-0549 1256 Seamans Center
Sys_admin/Postmaster/cell_admin Iowa City, IA 52242-1527
#include <std_disclaimer.h>
Better is not better, 'standard' is better. B{



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Dan O'Brien
2003-07-11 00:09:27 UTC
Permalink
Simon Byrnand <***@igrin.co.nz> wrote:
> Is there any special reason you need the Envelope-Recipient ? If you run
SA
> from the local delivery agent you already know who the recipient is when

> procmail is called, if you run SA from a filter like Mimedefang then
there
> are potentially *multiple* recipients at the point the message is
scanned
> anyway...

I'm using SA+sendmail+spamass-milter in a relay environment in front of a
Lotus Domino server. When it's ultimately delivered to the user in
Domino, the equivalent of the X-Envelope-Recipient header is stored in the
SMTPOriginator field. I've built some views that let me look at the
delivery information and have noticed a significant number of false
negatives that begin "perf-news-errors". I'd like to write a rule to add
3.0-4.0 points. I'm guessing I can get my caught spam up another percent
or so :-)

Dan



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Dan O'Brien
2003-07-11 00:21:30 UTC
Permalink
Yorkshire Dave <spamassassin-***@wot.no-ip.com>wrote:
> sendmail.cf
>
> #########################
> # Format of headers #
> #########################
>
> blah
> blah
>
> HX-Envelope-From: $g
> HX-Envelope-To: $u

Most Excellent!!! Works like a champ! Anybody have the sendmail.mc
format? I've got my milter definitions there and use make to generate
sendmail.cf (I probably lose 10 or 20 geek points for this -- and 5 more
for asking the question, but I can still write S/370 JES2 JCL, so I figure
I've got a few to spare).




-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
David B Funk
2003-07-11 23:49:34 UTC
Permalink
On Thu, 10 Jul 2003, Dan O'Brien wrote:

> Yorkshire Dave <spamassassin-***@wot.no-ip.com>wrote:
> > sendmail.cf
> >
> > #########################
> > # Format of headers #
> > #########################
> >
> > blah
> > blah
> >
> > HX-Envelope-From: $g
> > HX-Envelope-To: $u
>
> Most Excellent!!! Works like a champ! Anybody have the sendmail.mc
> format? I've got my milter definitions there and use make to generate
> sendmail.cf (I probably lose 10 or 20 geek points for this -- and 5 more
> for asking the question, but I can still write S/370 JES2 JCL, so I figure
> I've got a few to spare).

Yes, put them in the "LOCAL_CONFIG" section of your sendmail.mc file.
find the LOCAL_CONFIG keyword and put them just after it.

If you don't have a LOCAL_CONFIG section, then pick a spot after
the "DOMAIN" and "FEATURE" lines but before the "MAILER" and
"LOCAL_RULESETS" lines.
Insert the macro LOCAL_CONFIG on a line by itself, and then
put those header-defs just after it.



--
Dave Funk University of Iowa
<dbfunk (at) engineering.uiowa.edu> College of Engineering
319/335-5751 FAX: 319/384-0549 1256 Seamans Center
Sys_admin/Postmaster/cell_admin Iowa City, IA 52242-1527
#include <std_disclaimer.h>
Better is not better, 'standard' is better. B{



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Dan O'Brien
2003-07-11 01:33:59 UTC
Permalink
Simon Byrnand <***@igrin.co.nz> wrote:
> And I did try adding those headers on a test server to
> see if it does work, and it does, $u actually puts <> around the email
> address by itself and $g doesnt, so for them to look consistent, you
want
>
> HX-Envelope-From: <$g>
> HX-Envelope-To: $u

<scratching head>

Ok, perhaps I spoke too soon. It doesn't seem to be hitting my rule:

header AXON_PERF_NEWS X-Envelope-From =~ /^perf-news-errors\./
describe AXON_PERF_NEWS Envelope contains spam attributes
score AXON_PERF_NEWS 4.0

</scratching head>

Does SA care if it's not a "standard" header?




-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Loading...