Date fields disappear in forwarded messages

19 views
Skip to first unread message

Hiroshi Shimodaira

unread,
Apr 15, 2025, 11:39:11 AMApr 15
to mu-discuss
Hello,

I've noticed that when an original message is forwarded with mu4e, the date field of the original message disappears.
Of course, the new message that forwards the original has a date field, but the date field from the original message is not retained.  

Does anybody know how to fix this?

I'm using mu version 1.12.9 with Emacs 31.0.50 on MacOS 15.4.
I don't think I had the issue when I was using mu 1.12.4 + Emacs 29.4 last year.

My observation so far is that the date field is properly present in the compose buffer just before I type C-c C-c (message-send-and exit), or specifically, C-x C-s (save-buffer).

Kind regards,
Hiroshi

Dirk-Jan C. Binnema

unread,
Apr 15, 2025, 11:58:55 AMApr 15
to mu-di...@googlegroups.com
IIRC, this can be customized with the variables
message-forward-included-headers and message-forward-ignored-headers

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036

Hiroshi Shimodaira

unread,
Apr 15, 2025, 12:21:59 PMApr 15
to mu-discuss
Dear Dirk,

Thank you for your swift reply.
The current values of the variables in my environment are:
  message-forward-included-headers: ("^From:" "^Subject:" "^Date:" "^To:" "^Cc:")
  message-forward-ignored-headers: "^Content-Transfer-Encoding:\\|^X-Gnus"
So, I'm unsure why date fields are excluded.

Thanks,
Hiroshi

Dirk-Jan C. Binnema

unread,
Apr 16, 2025, 1:35:40 AMApr 16
to mu-di...@googlegroups.com
Hi Hiroshi,

On Tuesday Apr 15 2025, Hiroshi Shimodaira wrote:

> Dear Dirk,
>
> Thank you for your swift reply.
> The current values of the variables in my environment are:
> message-forward-included-headers: ("^From:" "^Subject:" "^Date:" "^To:"
> "^Cc:")
> message-forward-ignored-headers: "^Content-Transfer-Encoding:\\|^X-Gnus"
> So, I'm unsure why date fields are excluded.

So am I!

Those are the correct (default) values. And
`message-forward-included-headers' variable is honored when I try with
and without "^Date:". So it must be something else in your case.

If you're familiar with Elisp, I guess you could check what
`message-forward-make-body' does (it's fairly readable) and figure out
what is removing/not including that Date: header in your case.

Hiroshi Shimodaira

unread,
Apr 17, 2025, 7:41:00 AMApr 17
to mu-discuss
Hi Dirk,

Thank you for the pointer, but unfortunately, I don't speak Elisp :-(
Instead, by using the grep command, I think I've figured out a possible cause.

It seems that the following line in mu4e--compose-before-save in mu4e-draft.el removes all Date fields.
    (message-remove-header "Date")

When I comment it out, the issue seems to be resolved (without side-effects?).
However, the function mu4e--compose-before-save appears to have been unchanged since mu 1.12.3.
So, I suspect that the Gnus function message-remove-header may have recently changed its behaviour, but I've not looked into yet.

--- Hiroshi

Dirk-Jan C. Binnema

unread,
Apr 17, 2025, 11:58:49 AMApr 17
to mu-di...@googlegroups.com
Hi Hiroshi,

On Thursday Apr 17 2025, Hiroshi Shimodaira wrote:

> Hi Dirk,
>
> Thank you for the pointer, but unfortunately, I don't speak Elisp :-(
> Instead, by using the grep command, I think I've figured out a possible
> cause.
>
> It seems that the following line in mu4e--compose-before-save in
> mu4e-draft.el removes all Date fields.
> (message-remove-header "Date")
>
> When I comment it out, the issue seems to be resolved (without
> side-effects?).
> However, the function mu4e--compose-before-save appears to have been
> unchanged since mu 1.12.3.
> So, I suspect that the Gnus function message-remove-header may have
> recently changed its behaviour, but I've not looked into yet.

Ah, that gives some good hint: the problem happened only when save the
draft (which is why I didn't see it and suspected Gnus). The other hint
is that it removed the header in the _forwarded_ message, which it
shouldn't touch at all.

So, the problem is (in mu4e) was that message-remove-header expects to
be called while we've narrowed the buffer to just the headers
('message-narrow-to-headers'); otherwise, it will go through the whole
message deleting 'Date:' when it sees them... as you've discovered.

I've pushed a fix; thanks!
Reply all
Reply to author
Forward
0 new messages