Bug 356865 - Sent messages with Bcc receipients does not list Bcc
Summary: Sent messages with Bcc receipients does not list Bcc
Status: RESOLVED UNMAINTAINED
Alias: None
Product: trojita
Classification: Applications
Component: Message Composer (other bugs)
Version First Reported In: git
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Trojita default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-18 11:53 UTC by Erik Quaeghebeur
Modified: 2024-09-23 18:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Quaeghebeur 2015-12-18 11:53:02 UTC
When sending a mail that includes Bcc recipients, the saved copy of the sent mail does not contain a Bcc line.

Reproducible: Always

Steps to Reproduce:
1. Send message with Bcc recipients
2. Look at (the source of the) saved copy of that mail
3. Notice that no Bcc line is present
Comment 1 Erik Quaeghebeur 2016-01-05 13:39:37 UTC
I've looked at the code:

In src/Composer/Submission.cpp there is the function Submission::slotMessageDataAvailable that is responsible for creating the messages and saving them to the sent mail folder; it calls Submission::slotInvokeMsaNow() to send out the message. There is always an if-then(-else) to choose between sending the message ‘raw’ or using CATENATE (to add attachments). This function essentially (indirectly through MessageComposer::asRawMessage or MessageComposer::asCatenateData) calls the function MessageComposer::writeCommonMessageBeginning from src/Composer/MessageComposer.cpp to generate the header. In this function, the Bcc header is not included (as is appropriate for the version of the mail that is sent out).

So it seems that what would need to be done is to keep all the necessary data for the message in some variable, but not yet flattened to a single string. Then it can be flattened twice, including/excluding Bcc as appropriate, much later in the process. Does this seem like a good plan?

I may try my hand at a patch for this issue, but before starting, I need to have a good view of the architecture that seems appropriate to the maintainers.

P.S.: How the list of recipients to be passed to the MSA is created is still somewhat opaque to me, but my impression is that I won't need to bother with that.
Comment 2 Jan Kundrát 2016-01-05 18:29:55 UTC
> In this function, the
> Bcc header is not included (as is appropriate for the version 
> of the mail that is sent out).

Yeah, it seems that some MTAs out there (Exim is an example, [1]) do not 
strip out the Bcc headers during submission through ESMTP. Because Trojita 
tries to save bandwidth (see our support for BURL, CATENATE etc), there's a 
big value in only having to upload just one instance of an outgoing 
message.

It would be very easy to write out Bcc into the sent folder, but then we 
have to ensure that the Bcc is not leaked to the actual outgoing message. 
This is doable by, e.g., employing chunked message submission, where the 
composer remembers which part of the header contains this privacy-sensitive 
data, and white outs their content.

Here's how to do it:

1) Generate the plaintext of the message, place the Bcc header into a 
well-known place (end of all headers sounds like a trivial fix, if it's 
legal),
2) Remember the offsets of the beginning and end of this sensitive area,
3) Change the code to not treat the just-saved message as a single entity, 
but rather as a pair of (stuff before the whitened-out, stuff after), and 
pass this pair to BURL.

[1] http://marc.info/?l=mutt-dev&m=112930534206625
Comment 3 Erik Quaeghebeur 2016-03-08 23:00:22 UTC
(In reply to Jan Kundrát from comment #2)
>
> 1) Generate the plaintext of the message, place the Bcc header into a 
> well-known place (end of all headers sounds like a trivial fix, if it's 
> legal),

It is legal to place Bcc at the end. It is also legal to place it at the top, which would result in only having to remember one offset, I think.

> 2) Remember the offsets of the beginning and end of this sensitive area,
> 3) Change the code to not treat the just-saved message as a single entity, 
> but rather as a pair of (stuff before the whitened-out, stuff after), and 
> pass this pair to BURL.

I have tried to wrap my head around the code, but I'm not there yet.

Orthogonal to that, I wonder whether it would make more sense to instead split the message in (header, body), have header+bcc and header. I guess that would essentially mean uploading the header twice, which may still be acceptable bandwidth-wise, and seems simpler and more generic (also applicable to other cases where the header should be different for the sent-out and for the stored version, e.g., Resent-Bcc, which cannot appear at the end of the header... although it could appear at the top).
Comment 4 Jan Kundrát 2016-03-22 18:12:06 UTC
Just for the record -- if you cannot get around the code in the src/Composer/ easily, it probably means that the code needs to be documented. Patches which add documentation are very welcome.
Comment 5 Erik Quaeghebeur 2016-05-27 20:32:49 UTC
I have again been looking at the code. My current understanding is this:

There are 3 ways to send:
1. SMTP
2. BURL (SMTP)
3. IMAP (sending)

There are two ways to construct a message:
1. LOCAL
2. CATENATE

With message that have Bcc, we need to construct two messages, call them A(ppend) and S(ubmit).

* Case SMTP and LOCAL: locally create A and P, append A and plain-SMTP submit the S.

* Case SMTP and CATENATE: catenate-create/append A, locally create S (downloading A or parts thereof as needed?), plain-SMTP submit S.

* Case BURL and LOCAL: locally create A and P, append A and plain-SMTP submit the S. (BURL provides no shortcuts here?)

* Case BURL and CATENATE: catenate-create/append S, BURL-SMTP submit S, catenate-modify/append A from S, delete S.

* Case IMAP and LOCAL: locally create A and P, append A and IMAP-send S. (IMAP send provides no shortcut here?)

* Case IMAP and CATENATE: catenate-create/append S, IMAP-send S, catenate-modify/append A from S, delete S.

So, from the A and S-message construction point-of-view there are only three cases:

(SMTP or BURL or IMAP) and LOCAL, SMTP and CATENATE, (BURL or IMAP) and CATENATE

Is this analysis correct?
Comment 6 Jan Kundrát 2016-05-29 09:30:14 UTC
> Is this analysis correct?

I do not fully understand what the analysis means; the usage of "P" is 
unclear to me.

You're right in the big-picture sense -- there are indeed two possible 
varieties in "how to produce a representation of a message", the "let's 
build everything locally and produce a single blob" and a second "use a 
mixture if blobs and IMAP URLs".

Then there are several submission methods, and some can only use the 
"single blob" version of obtaining a message source.

If you're assuming that you need to expand these two versions to four 
versions because there's now a mixture of two booleans in the input:

1) do we require blobs of everything, or can we use IMAP URLs?
2) can we include the "private" parts (Bcc for now), or should we filter 
them out locally?

...then you're also right.
Comment 7 Erik Quaeghebeur 2016-05-29 10:13:47 UTC
(In reply to Jan Kundrát from comment #6)
> 
> I do not fully understand what the analysis means; the usage of "P" is 
> unclear to me.

Sorry, P should be S.
Comment 8 Christoph Cullmann 2024-09-23 18:50:59 UTC
Trojitá is no longer maintained, please switch to a maintained alternative like https://apps.kde.org/kmail2/

Sorry for the inconveniences.