Mu4e: Try to reply with To: addr, else prompt
This commit is contained in:
parent
2483d47021
commit
7208b3de64
17
config.org
17
config.org
|
@ -1633,6 +1633,23 @@ Let's send emails too.
|
|||
message-send-mail-function 'message-send-mail-with-sendmail))
|
||||
#+END_SRC
|
||||
|
||||
It's also nice to avoid accidently sending emails with the wrong account.
|
||||
If we can send from the address in the ~To~ field, let's do that. Opening an ~ivy~
|
||||
prompt otherwise also seems sensible.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(after! mu4e
|
||||
(defun my-mu4e-set-account ()
|
||||
"Set the account for composing a message."
|
||||
(when (and mu4e-compose-parent-message
|
||||
(let ((mail (cdr (car (mu4e-message-field mu4e-compose-parent-message :to)))))
|
||||
(if (member mail (plist-get mu4e~server-props :personal-addresses))
|
||||
(setq user-mail-address mail)
|
||||
nil))
|
||||
(ivy-read "Account: " (plist-get mu4e~server-props :personal-addresses) :action (lambda (candidate) (setq user-mail-address candidate))))))
|
||||
|
||||
(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account))
|
||||
#+END_SRC
|
||||
|
||||
We can register Emacs as a potential email client with the following desktop
|
||||
file, thanks to Etienne Deparis's [[https://etienne.depar.is/emacs.d/mu4e.html][Mu4e customization]].
|
||||
#+BEGIN_SRC conf :tangle ~/.local/share/applications/emacsmail.desktop
|
||||
|
|
Loading…
Reference in New Issue