help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnus: How to easily change "From:" from the default to a second acco


From: Philipp Haselwarter
Subject: Re: Gnus: How to easily change "From:" from the default to a second account's address?
Date: Fri, 25 Nov 2011 03:17:02 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.91 (gnu/linux)

I often find myself wanting to change the From: after opening the
message; this allows picking one of your accounts:

#+begin_src emacs-lisp
(defcustom my-smtp-accounts nil
  "*list of available smtp accounts"
  :group 'smtpmail
  :type '(repeat alist))

(defun my-pick-smtp ()
  (interactive)
  (setq user-mail-address
        (let ((f (if (functionp 'ido-completing-read)
                     'ido-completing-read
                   completing-read)))
          (funcall f "Which smtp acc:" (mapcar 'cadr my-smtp-accounts))))
  (save-excursion
    (save-restriction
      (message-narrow-to-headers-or-head)
      (message-remove-header "From")
      (goto-char (point-max))
      (insert "From: " (message-make-from) "\n"))))

#+end_src

-- 
Philipp Haselwarter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]