[Top][All Lists]

[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 <> 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.


> 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 ()
  (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

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)

However, I hardly grasp why you'd want to change this.  An authinfo
files may hold several machines.  Mine holds 13.

Happy hacking.



Sent from my Emacs

reply via email to

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