send: Add mail header to identify reflect messages
PATCH 1/1 send: Add mail header to identify reflect messages
Series are often send with reflect before actual submission to check the To/Cc and the content. Those reflected series are difficult to identify as they are intended to be exaclty the same as the real mails.
To allows people to write filters for those reflect mails, add a b4-specific header X-B4-Reflect.
---
--- docs/contributor/send.rst | 1 + src/b4/__init__.py | 2 ++ 2 files changed, 3 insertions(+)
docs/contributor/send.rst +1 -0
@@ -229,6 +229,7 @@ When ``--reflect`` is on: * when using the web endpoint, the messages aren't added to the public-inbox feed * your branch is **not** automatically rerolled to the next revision +* A specific header, ``X-B4-Reflect``, is set to ``1``. Checking things over with ``--preview-to`` **(v0.13+)** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/b4/__init__.py +2 -0
@@ -3960,6 +3960,8 @@ def send_mail(smtp: Union[smtplib.SMTP, smtplib.SMTP_SSL, None], msgs: Sequence[ for msg in msgs: if not msg.get('X-Mailer'): msg.add_header('X-Mailer', f'b4 {__VERSION__}') + if not msg.get('X-B4-Reflect') and reflect: + msg.add_header('X-B4-Reflect', f'1') msg.set_charset('utf-8') if dryrun or web_endpoint:
---
base-commit: 88a27ce9018a1e886829be0a57336ae0594413e1
change-id: 20240910-reflect-header-6e63dd90c6a8
Best regards,
Signature · 1 line
Louis Chauvet <[email protected]>
Quoted 6 lines · Louis Chauvet
Series are often send with reflect before actual submission to check the To/Cc and the content. Those reflected series are difficult to identify as they are intended to be exaclty the same as the real mails.
To allows people to write filters for those reflect mails, add a b4-specific header X-B4-Reflect.
I think we should actually put REFLECT into the subject, same as we do with preview. I know the messages are supposed to look exactly as if they're actually sent to the lists, but we can put "except REFLECT in the subject".
That would be a lot easier to identify than a header for a quick visual "did I send this series yet?"
-K
Quoted 8 lines · Konstantin Ryabitsev
Quoted 6 lines · Louis Chauvet
Series are often send with reflect before actual submission to check the To/Cc and the content. Those reflected series are difficult to identify as they are intended to be exaclty the same as the real mails.
To allows people to write filters for those reflect mails, add a b4-specific header X-B4-Reflect.
Quoted 8 lines
I think we should actually put REFLECT into the subject, same as we do with preview. I know the messages are supposed to look exactly as if they're actually sent to the lists, but we can put "except REFLECT in the subject".
That would be a lot easier to identify than a header for a quick visual "did I send this series yet?"
-K
For me the whole point of reflect is to have the exact same message, including the subject, so other tools involved (at least web endpoints for example) can treat it as a "normal" patch, that why I added a header and not a prefix.
I agree this is not very "visual". If you think adding a prefix is not an issue for existing tools, I can do a patch to add the REFLECT prefix.
Signature · 3 lines
Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com