Amelia A Lewis wrote:
Or, in other words, how much header munging does the IMAP-send-enabled MUA do, and how much is left to the IMAP-send-enabled imapd? If imapd sets SMTP MAIL FROM:, does it also munge From:? Sender:?
Resent-From:? List-From:? X-Secret-Message-From:?
It only munges BCC: by deleting it. Standard sendmail does the same when you call it with -t and provide a message on the standard input.
The "IMAP Outbox" feature has been around for quite a while. You don't need to change Dovecot to implement it. Given maildir storage, just scan users "Outbox" folders and pipe any message found there to "sendmail -t", then move it to the "Sent" folder on success.
Here's the relevant part of the exim documentation (which is feature compatible to sendmail on the command line):
-t
When Exim is receiving a locally-generated, non-SMTP message on its standard input, the -t option causes the recipients of the message to be obtained from the To:, Cc:, and Bcc: header lines in the message instead of from the command arguments. The addresses are extracted before any rewriting takes place.
If the command has any arguments, they specify addresses to which the message is not to be delivered. That is, the argument addresses are removed from the recipients list obtained from the headers. This is compatible with Smail 3 and in accordance with the documented behaviour of several versions of Sendmail, as described in man pages on a number of operating systems (e.g. Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail add argument addresses to those obtained from the headers, and the O'Reilly Sendmail book documents it that way. Exim can be made to add argument addresses instead of subtracting them by setting the option extract_addresses_remove_arguments false.
If a Bcc: header line is present, it is removed from the message unless there is no To: or Cc:, in which case a Bcc: line with no data is created. This is necessary for conformity with the original RFC 822 standard; the requirement has been removed in RFC 2822, but that is still very new.
If there are any Resent- header lines in the message, Exim extracts recipients from all Resent-To:, Resent-Cc:, and Resent-Bcc: header lines instead of from To:, Cc:, and Bcc:. This is for compatibility with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if -t was used in conjunction with Resent- header lines.)
RFC 2822 talks about different sets of Resent- header lines (for when a message is resent several times). The RFC also specifies that they should be added at the front of the message, and separated by Received: lines. It is not at all clear how -t should operate in the present of multiple sets, nor indeed exactly what constitutes a “set”. In practice, it seems that MUAs do not follow the RFC. The Resent- lines are often added at the end of the header, and if a message is resent more than once, it is common for the original set of Resent- headers to be renamed as X-Resent- when a new set is added. This removes any possible ambiguity.
/tom