summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-12 23:48:56 +0000
committerjao <jao@gnu.org>2022-01-12 23:48:56 +0000
commit725e86ae70a3d5ae93b2a6c337943f32d2b278d2 (patch)
treea890975a047917f60d848e3b2cc4d819a201de0b
parent9e8f967ba282f9e582807ce3de7fc63ab38fee33 (diff)
downloadelibs-725e86ae70a3d5ae93b2a6c337943f32d2b278d2.tar.gz
elibs-725e86ae70a3d5ae93b2a6c337943f32d2b278d2.tar.bz2
jao-message-to-from utilitiy
-rw-r--r--email.org15
1 files changed, 14 insertions, 1 deletions
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