[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how can I toggle smtp auth files
From: |
Rasmus |
Subject: |
Re: how can I toggle smtp auth files |
Date: |
Sun, 18 Sep 2011 19:16:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
bsquared <bwcode4u@gmail.com> writes:
> Thanks for the reply.
>
> I saw that wiki page, and I thought there must be a simpler way;
> however, I think that the method of using a message header was
> interesting.
OK.
> If I reply to an email from account 1 then I want to use '~/authinfo.1',
> and likeways for account 2 and '~/authinfo.2'.
Anyhow, you write a simple function that checks the From field.
Use something like (not tested and not complete):
#+begin_src emacs-lisp
(defun ()
"docstring"
(if (equal (message-sendmail-envelope-from) "mail1")
(setq smtpmail-auth-credentials "authinfo1")
(setq smtpmail-auth-credentials "authinfo2")
)
;; Check out eldoc to get help on Emacs Lisp
#+end_src
This¹ page mentions several variables that may be of interest.
Then, you'd want to add this function to a hook, which is run before the
mail is delivered to the SMTP server. Probably message-send-hook,
something like
#+begin_src emacs-lisp
(add-hook 'message-send-hook 'my-fun)
#+end_src
However, I hardly grasp why you'd want to change this. An authinfo
files may hold several machines. Mine holds 13.
Happy hacking.
–Rasmus
Footnotes:
¹ http://www.emacswiki.org/emacs-en/GnusAuthinfo
--
Sent from my Emacs