From 725e86ae70a3d5ae93b2a6c337943f32d2b278d2 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 12 Jan 2022 23:48:56 +0000 Subject: jao-message-to-from utilitiy --- email.org | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/email.org b/email.org index ce4fc8a..bbbdd60 100644 --- a/email.org +++ b/email.org @@ -76,7 +76,7 @@ (setq message-expand-name-standard-ui t) #+end_src -*** Bcc +*** To->From and Bcc #+begin_src emacs-lisp (defvar jao-message--bcc-rx (regexp-opt '("mail.io" "gnu.org"))) @@ -87,6 +87,19 @@ (add-hook 'message-header-setup-hook #'jao-message-insert-bcc) + (defvar jao-message-to-from nil) + + (defun jao-message-adjust-from () + (let ((to (concat (message-fetch-field "To") (message-fetch-field "Cc")))) + (when-let* ((tf (seq-find (lambda (tf) (string-match-p (car tf) to)) + jao-message-to-from)) + (from (message-make-from "Jose A Ortega Ruiz" (cdr tf)))) + (save-restriction + (widen) + (message-replace-header "From" from))))) + + (add-hook 'message-header-setup-hook #'jao-message-adjust-from) + #+end_src *** Encryption #+begin_src emacs-lisp -- cgit v1.2.3