reddit / emacs

Forwarding emails in notmuch

Tohiko · 2022-03-19 14:52
When I try to forward an email in notmuch, I get a new message where the email is included between ``` -------------------- Start of forwarded message -------------------- <#multipart type=mixed> <#part type=text/plain charset="utf-8" disposition=inline nofile=yes description="Mail message body"> ``` and ``` <#/part><#/multipart> -------------------- End of forwarded message -------------------- ``` It it unclear to me where I should include my message to the forwarded email. I tried adding it before and after this text, but my text does not actually show up on all email clients of my recipients (for example Gmail). This style of forwarding is different from what I am used. I came from `mu4e` and other email clients where an email is usually quoted (as it would have been for a reply) and then I usually top-post my additional message. How do I correctly forward a message in notmuch? Is there a way to have a more "traditional" forwarding format which uses the same format as when replying (with a different message subject)?
holgerschurig · 2022-03-19 17:33
Maybe the (customizable) variable `message-forward-as-mime` is something for you? It controls if the forwarded message is put inline into the message body or attached as a MIME part. If you like the forwarded message in-line, but in a different format, you'll have to redefine this function to your liking: (defun message-forward-make-body-plain (forward-buffer) (insert "\n-------------------- Start of forwarded message --------------------\n") (let ((b (point)) (contents (with-current-buffer forward-buffer (buffer-string))) e) (unless (multibyte-string-p contents) (error "Attempt to insert unibyte string from the buffer \"%s\"\ to the multibyte buffer \"%s\"" forward-buffer (buffer-name))) (insert (mm-with-multibyte-buffer (insert contents) (mime-to-mml) (goto-char (point-min)) (when (looking-at "From ") (replace-match "X-From-Line: ")) (buffer-string))) (unless (bolp) (insert "\n")) (setq e (point)) (insert "-------------------- End of forwarded message --------------------\n") (message-remove-ignored-headers b e)))
Tohiko · 2022-03-20 10:06
I don't think I want the attach the message as mime. Changing this function does seem to be the way to go, but I was wondering if I can use the machinery that notmuch already has when constructing replied messages. This seems to require more digging that I initially anticipated.