[Top][All Lists]

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

Re: Default for the envelope From in smtpmail.el

From: Nix
Subject: Re: Default for the envelope From in smtpmail.el
Date: Tue, 04 Sep 2012 14:13:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

On 13 Aug 2012, Stephen J. Turnbull stated:
> I suppose it would be possible to enhance user-mail-address to
> something like user-mail-configurations, which would be a list of
> course Gnus already supports this kind of thing (I forget the Gnus
> name for the feature, as does VM ("personality crisis").

By coincidence I just had to do exactly that:

| (defvar nix-overriding-smtp-servers '(("address@hidden" 
"[work.mailserver.host.censored]" 465 ssl))
|   "List of SMTP servers to override the default with.
| An alist with each element of the form (EMAIL-ADDRESS SMTP-SERVER SMTP-PORT 
| (defun nix-get-overriding-smtp-servers ()
|   (save-excursion
|     (loop with from = (save-restriction
|                         (message-narrow-to-headers)
|                         (message-fetch-field "from"))
|           for (addr server port stream-type) in nix-overriding-smtp-servers
|           when (string-match addr from) return (list server port stream-type)
|           finally return (list smtpmail-smtp-server smtpmail-smtp-service 
| (defadvice smtpmail-via-smtp
|   (around change-smtp-by-message-from-field (recipient buffer &optional ask) 
|   (with-current-buffer buffer
|     (progv '(smtpmail-smtp-server smtpmail-smtp-service smtpmail-stream-type)
|         (nix-get-overriding-smtp-servers)
|       ad-do-it)))

Not killingly difficult, but something it would be nice if we didn't
have to do every time.

> IIRC, Glenn was specifically referring to Gnus.  So if he rephrases
> slightly to specify that MUA "personality" customizations should offer
> this option and documentation explaining when it makes sense, I think
> everybody would be happy.

Yes. As seen above, you can do it yourself, but you shouldn't need to,
not really: like gnus-posting-styles, this should be something Gnus (or
message mode) does for you.

NULL && (void)

reply via email to

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