email - Multiple e-mail accounts using Emacs with RMAIL and Message packages -
i'm trying prepare rmail , emacs back upwards multiple e-mail accounts. have solution utilize different smtp servers based on from field of e-mail (based on info in emacswiki), have set from field manually.
what want set from field automatically when replying in rmail (i.e. when replying e-mail delivered account1@example.net, set from in compose message buffer account1@example.net). utilize message bundle mail-user-agent. gnus have similar feature called gnus-posting-styles.
what need, exactly, below:
when press r or m-x rmail-reply on rmail summary, account1@example.net or account2@example.net in fields to, cc, envelope-to, x-origintal-to or delivered-to of replied message , store first 1 found in variable;
already on message buffer compose e-mail, automatically set field stored value.
there way perform 1?
thank you!
yes, there's way this.
you need advise function rmail-reply.
here's example:
(defadvice rmail-reply (around rmail-grab-to-field) "grab field , set in reply 'from'." (let ((origin-to (mail-fetch-field "to"))) (progn ad-do-it) (save-excursion (goto-char (point-min)) (perform-replace "^from: \\(.*\\)$" (concat "from: " origin-to) nil t nil 1 nil (point-min) (point-max))))) (ad-activate 'rmail-reply)you can find out advice in emacslisp manual.
the above advice isn't generic, depends little on mode utilize sending mail service (i utilize message-mode , above code works).
a improve version delimit extent of perform-replace alter in mail service header.
email emacs
No comments:
Post a Comment