ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.14k stars 155 forks source link

`In-Reply-To` header spuriously missing when using `git send-email` #374

Closed y86-dev closed 1 year ago

y86-dev commented 1 year ago

When sending email patches to the Linux kernel mailing list via git send-email and the protonmail bridge, at some point the emails miss the In-Reply-To header. Additionally the References header only contains the internal protonmail id and also drops the one requested by git send-email. This does not affect every email, but after one email from a patch series is affected, every email after it also misses the headers.

Expected Behavior

Protonmail bridge should not remove the supplied headers.

Current Behavior

When sending emails to a mailing list, at some arbitrary email the headers stop being set correctly.

Possible Solution

Steps to Reproduce

  1. patch series consisting of 15 emails + the cover letter. The first seven patches are In-Reply-To the cover letter (this is correct): https://lore.kernel.org/rust-for-linux/20230331215053.585759-1-y86-dev@protonmail.com/ the rest are scattered for example: https://lore.kernel.org/rust-for-linux/20230331215053.585759-9-y86-dev@protonmail.com/
  2. Also see the previous patch series: https://lore.kernel.org/rust-for-linux/20230329223239.138757-1-y86-dev@protonmail.com/

I also tried sending the patches with --relogin-delay=7 and --batch-size=1, this results in every email being sent via new smtp session.

Version Information

Protonmail bridge: v3.0.21 git version: 2.39.2

Context (Environment)

Patches should be sent in the correct thread. It is very inconvenient to have to copy 16 emails into the webclient, set the correct contacts every single time (it can be upwards of 8 recipients!) and then also reply to the correct email. So it would be best if the solution enables the use of git send-email. Maybe there are some configuration options in git send-email that can help here, but as I cannot even debug the problem, I have no idea what to try. Another problem is that this did not occur when I sent them to a single contact. This has also happened to other users, see here: https://lore.kernel.org/git/Yl4zGh5VZTPVjV4D@ArchDesktop/

I also saw #122 but I think this issue is different.

y86-dev commented 1 year ago

I have tried debugging this issue myself now and got the following information:

This also affects the References header.

My personal issue happened, because I am also subscribed to that mailing list, so when I receive my own message from the list, the bridge now finds two messages with the same external ID. This prompts the In-Reply-To header to be dropped from any further messages, since the bridge finds two messages with the same ID.

The problem lies here: https://github.com/ProtonMail/proton-bridge/blob/master/internal/user/smtp.go#L297

rlejeune74 commented 1 year ago

Thanks @y86-dev for the report and all the provided information to Customer Support. GODT-2569 has been open as internal ticket and will be investigated.

OneDeuxTriSeiGo commented 1 year ago

I can echo this issue:

https://lore.kernel.org/git/20230417093255.31079-1-jacobabel@nullpo.dev/raw

loses the In-Reply-To header (which should contain 20230109173227.29264-1-jacobabel@nullpo.dev).

rlejeune74 commented 1 year ago

@y86-dev I've cherry-picked your fix into our internal repository. It will be part of an upcoming release. Thank you for your contribution!

suhail-singh commented 6 months ago

@rlejeune74 I am experiencing symptoms similar to those described in this issue (In-Reply-To header is dropped when responding to mail not addressed to me, i.e., when the bridge wouldn't be able to find its message-id).

In which version of the bridge was the fix applied?

suhail-singh commented 6 months ago

I am unfamiliar with the code, but at a cursory glance it seems it still tries to ensure that it can locate the referenced parent? See https://github.com/ProtonMail/proton-bridge/blob/384fa4eb4bd760f1e0555774f7dae2fa7503d859/internal/services/smtp/smtp.go#L344

When responding to emails from a public mailing list to which one isn't subscribed the message-id would not have been "received" by the account.