What happens to TO field when forwarding occurs
What happens to TO field when forwarding occurs
am 12.11.2007 16:07:44 von Harry Putnam
I've googled on this question but finding only piles of information
about how to setup mail forwarding. That isn't my question.
I'd like to understand how it occurs. That is, what makes it go to
the new address, since the `To:' field remains the same throughout the
transaction.
Hopefully someone can send me to the documentation that explains this
in laymens language.
For example: I send an email to alonzo@newsguy.com who on that account
has a procmail recipe like:
## Forward mail for alonzo@newsguy.com to alonzo@somewhere.com
:0
* ^To: alonzo@newsguy.com
| /usr/sbin/sendmail -oi alonzo@somewhere.com
When alonzo@somewhere.com gets the message it will still have
To: alonzo@newsguy.com in the `TO' field.
So how does the message travel to Alonzo@somewhere.com when the `TO'
field says `To: Alonzo@newsguy.com'. Some other mechanism than the `TO'
field must be used for the last leg. Or perhaps the To field gets
rewritten.
I looked up the sendmail flags -o and -i but couldn't really make
anything out of what I found:
-i Ignore dots alone on lines by themselves in incoming messages.
This should be set if you are reading data from a file.
Ok, that one is simple enough
This is the only thing I found for -o
-ox value
Set option x to the specified value. This form uses
single charac- ter names only. The short names are not
described in this manual page; see the Sendmail
Installation and Operation Guide for details.
And I didn't make out what that really does.
Re: What happens to TO field when forwarding occurs
am 12.11.2007 16:35:59 von gtaylor
On 11/12/07 09:07, reader@newsguy.com wrote:
> What happens to TO field when forwarding occurs
> I've googled on this question but finding only piles of information
> about how to setup mail forwarding. That isn't my question.
>
> I'd like to understand how it occurs. That is, what makes it go to
> the new address, since the `To:' field remains the same throughout
> the transaction.
>
> Hopefully someone can send me to the documentation that explains this
> in laymens language.
I don't have any document per-say, but hopefully this email will help
you understand.
When you send an email via SMTP, there are really two pieces to the
message, the SMTP Envelope and the SMTP message contents. What you type
in your email client, see on screen, and in your mail box file is the
SMTP message. The part that really tells servers where you are sending
your message is the SMTP envelope. When two servers talk they have a
dialog somewhat like the following:
<<< 220 ESMTP remote-server.domain.tld says helo
>>> EHLO client.domain.tld
<<< 250 Hello client.domain.tld nice to meet you.
>>> MAIL FROM:
<<< 250 2.1.0 ... Sender ok
>>> RCPT TO:
<<< 250 2.1.1 ... Recipient ok
>>> DATA
<<< 3?? Send the data followed by a "." on a line by its self.
>>>
>>> .
<<< 250 Message accepted for delivery: Queue ID
>>> QUIT
<<< 250 Thank you and have a nice day.
(Note: I probably have some of the status codes not quite correct.)
The 'MAIL FROM:' and 'RCPT TO:'
are the SMTP envelope that specify who the message is from and to, not
the contents of the To: and From: headers inside of the SMTP message DATA.
In short, everything about this message that you are reading is the
contents of the message it self, not the SMTP envelope (aside from the
fact that this is a NNTP news group, not an SMTP message).
> For example: I send an email to alonzo@newsguy.com who on that
> account has a procmail recipe like:
The 'MAIL FROM:' and 'RCPT TO:' SMTP verbs dictate who the message is
from and to.
> ## Forward mail for alonzo@newsguy.com to alonzo@somewhere.com
>
> :0
> * ^To: alonzo@newsguy.com
> | /usr/sbin/sendmail -oi alonzo@somewhere.com
>
> When alonzo@somewhere.com gets the message it will still have To:
> alonzo@newsguy.com in the `TO' field.
>
> So how does the message travel to Alonzo@somewhere.com when the `TO'
> field says `To: Alonzo@newsguy.com'. Some other mechanism than the
> `TO' field must be used for the last leg. Or perhaps the To field
> gets rewritten.
Procmail will generate a new message based on the contents of the
original one and send that new message with the SMTP envelope being from
(likely) the account that Procmail is running under and to
alonzo@smewhere.com.
Grant. . . .
Re: What happens to TO field when forwarding occurs
am 12.11.2007 16:37:01 von Mark Hansen
On 11/12/07 07:07, reader@newsguy.com wrote:
> I've googled on this question but finding only piles of information
> about how to setup mail forwarding. That isn't my question.
>
> I'd like to understand how it occurs. That is, what makes it go to
> the new address, since the `To:' field remains the same throughout the
> transaction.
>
> Hopefully someone can send me to the documentation that explains this
> in laymens language.
Well, I'm not a sendmail expert and I don't play one on TV. However I think
I understand this issue enough to comment on it. I expect someone will correct
me if I'm wrong. Consider the similarities between an e-mail message and
a letter sent via Postal Mail. The To: header in the e-mail message is analogous
to the "Dear John" part of the paper letter. It's inside the envelope and is not
what actually sends the letter to its destination.
The "envelope address" is what is used to actually route the letter. An e-mail
message has something similar. It is not part of the message itself, so you
won't see it looking at the e-mail headers.
So, when a program like procmail sees the forward request, it just fires up
a connection to the local mail transfer agent (MTA) and says "hey, please
take my message and deliver it to this new address".
Hope this helps,
>
> For example: I send an email to alonzo@newsguy.com who on that account
> has a procmail recipe like:
>
> ## Forward mail for alonzo@newsguy.com to alonzo@somewhere.com
> :0
> * ^To: alonzo@newsguy.com
> | /usr/sbin/sendmail -oi alonzo@somewhere.com
>
> When alonzo@somewhere.com gets the message it will still have
> To: alonzo@newsguy.com in the `TO' field.
>
> So how does the message travel to Alonzo@somewhere.com when the `TO'
> field says `To: Alonzo@newsguy.com'. Some other mechanism than the `TO'
> field must be used for the last leg. Or perhaps the To field gets
> rewritten.
>
> I looked up the sendmail flags -o and -i but couldn't really make
> anything out of what I found:
>
> -i Ignore dots alone on lines by themselves in incoming messages.
> This should be set if you are reading data from a file.
>
> Ok, that one is simple enough
>
> This is the only thing I found for -o
> -ox value
> Set option x to the specified value. This form uses
> single charac- ter names only. The short names are not
> described in this manual page; see the Sendmail
> Installation and Operation Guide for details.
>
> And I didn't make out what that really does.
Re: What happens to TO field when forwarding occurs
am 12.11.2007 18:47:40 von Harry Putnam
reader@newsguy.com writes:
> ## Forward mail for alonzo@newsguy.com to alonzo@somewhere.com
> :0
> * ^To: alonzo@newsguy.com
> | /usr/sbin/sendmail -oi alonzo@somewhere.com
OK, thanks posters... so the sendmail command:
/usr/sbin/sendmail -oi alonzo@somewhere.com
Is telling the mta to change the envelope sender from
alonzo@newsguy.com to alonzo@somewhere.com and the actual `To:' field
never really comes into play far as transport is concerned.
Analogous to a snail mail envelope being put bodily into a clean new
envelope with the new recipient on it. (and new from information).
Re: What happens to TO field when forwarding occurs
am 12.11.2007 19:24:01 von Harry Putnam
reader@newsguy.com writes:
> reader@newsguy.com writes:
>
>> ## Forward mail for alonzo@newsguy.com to alonzo@somewhere.com
>> :0
>> * ^To: alonzo@newsguy.com
>> | /usr/sbin/sendmail -oi alonzo@somewhere.com
>
> OK, thanks posters... so the sendmail command:
> /usr/sbin/sendmail -oi alonzo@somewhere.com
>
> Is telling the mta to change the envelope sender from
> alonzo@newsguy.com to alonzo@somewhere.com and the actual `To:' field
> never really comes into play far as transport is concerned.
>
> Analogous to a snail mail envelope being put bodily into a clean new
> envelope with the new recipient on it. (and new from information).
PS- I see the envelope from information contained in some of the
`Received:' headers... but is there anyway to ascertain the envelop
`To' information from an emails' headers?
Re: What happens to TO field when forwarding occurs
am 13.11.2007 01:41:44 von gtaylor
On 11/12/2007 12:24 PM, reader@newsguy.com wrote:
> PS- I see the envelope from information contained in some of the
> `Received:' headers... but is there anyway to ascertain the envelop
> `To' information from an emails' headers?
If there is only one recipient, you can probably see it in the last
(top) received header. If there are multiple recipients, you will have
to check mail logs.
Grant. . . .