From 67886c900331faeb6dd7a705bcafcadda1f724b8 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Fri, 15 Mar 2024 17:25:37 +0000 Subject: [PATCH] Preserve the buffer-local value of user-mail-address When message-make-fqdn is called as part of constructing a message ID, the value of user-mail-address is likely to be used to provide the domain portion of the ID. Restore the killed value of user-mail-address after org-msg-edit-mode is activated, to ensure that message IDs show a domain that matches the sender. --- org-msg.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/org-msg.el b/org-msg.el index ea578be..919bbcf 100644 --- a/org-msg.el +++ b/org-msg.el @@ -1212,7 +1212,12 @@ MML tags." (if (org-msg-message-fetch-field "to") (org-msg-goto-body) (message-goto-to)) - (org-msg-edit-mode)) + ;; Preserve the buffer-local value of user-mail-address to + ;; ensure that message IDs generated from it will be using a + ;; domain name that matches the sender. + (let ((address user-mail-address)) + (org-msg-edit-mode) + (setq-local user-mail-address address))) (set-buffer-modified-p nil))))) (defun org-msg-post-setup--if-not-reply (&rest args)