[Dovecot] Envelope From changed - why?

Tom Alsberg alsbergt at cs.huji.ac.il
Tue Apr 27 15:53:39 EEST 2004


On Tue, Apr 27, 2004 at 12:39:24PM +0200, Miquel van Smoorenburg wrote:
> On 2004.04.27 09:53, Tom Alsberg wrote:
> ><snip />
> > Well, my MTA, as most others, does add a Return-Path: header.  Usually
> > it contains the same information as the From_ line, but not always, 
> 
> I think that would be a bug.

Now that I checked it, you're right here...

> > IIRC (the Return-Path: header, IIRC, may be altered/added to by an 
> > SMTP relay in the way
> 
> No, the Return-Path header is not present at SMTP transport time. It is
> added the moment the message leaves the SMTP domain, i.e. the moment it
> drops into a local mbox (or is sent through another transport like UUCP).

True.  Sorry for the confusion - had to refresh my understanding.

> That is the same moment a From_ header is added, and the content should
> be the same.

Well, the From_ line is not a header.  It is stored in Unix
(traditional mbox style) mailboxes, and originally (as in - early
Unix mail withing the host, where the "mail" command would just
append the message into /var/mail/<username>, before Intenet/ARPAnet 
mail embraced with SMTP, etc.) was the only line stored except the 
message body, containing the username of the sender and the date.
Nowadays, of course, it contains the full e-mail address 
(<username>@<domain>) in case the message travelled through the net.

> > while the envelope From_ line is guaranteed to remain as it was).
> 
> The From_ line is only retained over UUCP, no other transport has a
> From_ line in the message. SMTP certainly doesn't.

SMTP doesn't have a From_ line in the message, as it is not really part
of the message, like the headers and body are.  It is part of the SMTP
protocol however, in a slightly different form:

In the SMTP protocol, sending a message begins with "MAIL FROM 
<address>", and if the message goes through another server in the 
way, the relay over it will also begin with the same "MAIL FROM 
<address>" command.  That, AFAIK, is called the SMTP envelope.  At 
the end-point MTA, the FROM part of the SMTP envelope is written in 
the form of a "From " line.  However, that's the same thing - so SMTP 
does actually retain that line in the protocol.

"MAIL FROM <address>" is the direct protocol to the "From " line 
leading a message in a traditional mbox file.
 
> Well, when COPYing mailboxes over IMAP dovecot should be able to 
> retain the From_ line I suppose

That's what I mean - when the IMAP COPY command is issued, the From_
line should be copied together with the rest of the actual message.

> (if the internal API is rich enough) - but if the MUA does 
> something like get message from folder A and write it to folder B 
> (which many clients still do) the From_ line gets lost.

Well, if the MUA does this, then naturally dovecot can't do much 
else, so it makes sense that it invents its own line (although, as 
you mentioned, it could use the Return-Path: header).  But it appears
that most MUAs issue the COPY command properly.

> I suppose the mbox folder code could get the basic info for the 
> From_ line from the Return-Path: header if it is present. That's 
> what my own mbox library for internal projects does...

That's possible.  But I'd prefer it if when COPYing a message, it 
would just copy the "From " line verbatim as well, and not get into 
this trouble, even though I see now that the content should normally
be the same (leave those semantics to the MTA...).

> Mike.

  Thanks,
  -- Tom

-- 
  Tom Alsberg - hacker (being the best description fitting this space)
  Web page:	http://www.cs.huji.ac.il/~alsbergt/
DISCLAIMER:  The above message does not even necessarily represent what
my fingers have typed on the keyboard, save anything further.



More information about the dovecot mailing list