Gnus development mailing list
 help / color / mirror / Atom feed
From: Johnny <yggdrasil@gmx.co.uk>
To: Richard Riley <rileyrg@googlemail.com>
Cc: ding@gnus.org
Subject: Re: Multiple SMTP servers with Gnus?
Date: Wed, 16 Feb 2011 16:12:01 +0000	[thread overview]
Message-ID: <87d3msarhq.fsf@gmx.co.uk> (raw)
In-Reply-To: <ytd3mukgbh.fsf@news.eternal-september.org> (Richard Riley's message of "Mon, 14 Feb 2011 12:26:26 +0100")

Richard Riley <rileyrg@googlemail.com> writes:
> I find this set up the best as when the code is in place all you need to
> do is add to the smtp-accounts, gnus-posting-styles and the
> .authinfo.gpg. 

Using this setup, I get queried for the SMTP-server password when
sending email, even though I have added the account details to the
.authinfo file:

machine imap.gmx.com login yggdrasil@gmx.co.uk password gmxpass port 993
machine mail.gmx.com login yggdrasil@gmx.co.uk password gmxpass port 587
machine imap.gmail.com login j.carlsson@gmail.com password gmailpass port 993
machine smtp.gmail.com login j.carlsson@gmail.com password gmailpass port 587

What am I doing wrong as it doesn't seem to care about .authinfo?

To make it work, I also had to use:

(require 'cl) ;Enable the 'loop' command
(setq message-send-mail-function 'smtpmail-send-it)
> ,----
> | (defun set-smtp (mech server port user password)
> |   "Set related SMTP variables for supplied parameters."
> |   (setq smtpmail-smtp-server server
> |         smtpmail-smtp-service port
> |         smtpmail-auth-credentials (list (list server port user password))
> |         smtpmail-auth-supported (list mech)
> |         smtpmail-starttls-credentials nil)
> |   (message "Setting SMTP server to `%s:%s' for user `%s'."
> |            server port user))
> | 
> | (defun set-smtp-ssl (server port user password &optional key cert)
> |   "Set related SMTP and SSL variables for supplied parameters."
> |   (setq starttls-use-gnutls t
> |         starttls-gnutls-program "gnutls-cli"
> |         ;; TODO: Add this to the server parameters
> |         ;; starttls-extra-arguments nil
> |         smtpmail-smtp-server server
> |         smtpmail-smtp-service port
> |         smtpmail-auth-credentials (list (list server port user password))
> |         smtpmail-starttls-credentials (list (list server port key cert)))
> |   (message
> |    "Setting SMTP server to `%s:%s' for user `%s'. (SSL enabled.)"
> |    server port user))
> | 
> | (defun change-smtp ()
> |   "Change the SMTP server according to the current from line."
> |   (interactive)
> |   (save-excursion
> |     (loop with from = (save-restriction
> |                         (message-narrow-to-headers)
> |                         (message-fetch-field "from"))
> |           for (auth-mech address . auth-spec) in smtp-accounts
> |           when (string-match address from)
> |           do (cond
> |               ((memq auth-mech '(cram-md5 plain login))
> |                (return (apply 'set-smtp (cons auth-mech auth-spec))))
> |               ((eql auth-mech 'ssl)
> |                (return (apply 'set-smtp-ssl auth-spec)))
> |               (t (error "Unrecognized SMTP auth. mechanism: `%s'." auth-mech)))
> |           finally (error "Cannot infer SMTP information."))))
> | 
> | (add-hook 'message-send-hook 'change-smtp)
> | 
> | (setq smtp-accounts '(
> |                       (ssl "riley" "smtp.gmail.com" "587"
> |                            "rileyrg@gmail.com" nil)
> |                       (ssl "shamrock" "smtp.gmail.com" "587"
> |                            "shamrockirishbar@gmail.com" nil)))
(setq smtp-accounts '(
                      (ssl "gmx" "mail.gmx.com" "587"
                            "yggdrasil@gmx.co.uk" nil)
                      (ssl "gmail" "smtp.gmail.com" "587"
                           "j.carlsson@gmail.com" nil)))
> | (setq gnus-posting-styles `((".*"
> | 			     (from "Richard Riley <rileyrg@googlemail.com>")
> | 			     (eval(setq gnushush-user-agent-header (quote real)))
> | 			     (signature-file "~/.emacs.d/.sigs/rgr.sig")
> | 			     (eval (setq mml2015-signers '("********")))
> | 			     (eval (setq user-mail-address "rgr@richardriley.net"))
> | 			     (organization "aich tea tea pea dicky riley dot net"))))
(setq gnus-posting-styles `((".*"
			     (from "Johnny <yggdrasil@gmx.co.uk>")
			     (eval (setq user-mail-address "yggdrasil@gmx.co.uk"))
			     )))
> |      
> | (add-to-list `gnus-posting-styles `(,(rx(or "shamrock"))
> | 				    (from  "The Shamrock Irish Bar<shamrockirishbar@gmail.com>")
> | 				    (eval (setq user-mail-address "shamrock@shamrockirishbar.com"))
> | 				    (eval (setq mml2015-signers '("********")))
> | 				    (organization "http://www.shamrockirishbar.com")
> | 				    (signature-file "~/.emacs.d/.sigs/s.sig")) t)
(add-to-list `gnus-posting-styles `(,(rx(or "gmail"))
				    (from  "J Carlsson <j.carlsson@gmail.com>")
				    (eval (setq user-mail-address "j.carlsson@gmail.com"))
				    ) t)
> `----


Very useful functionality however to manage several email-adresses!

-- 
Johnny



  parent reply	other threads:[~2011-02-16 16:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 17:39 Robert Pluim
2011-02-09 17:46 ` Richard Riley
2011-02-09 18:06   ` Wes Hardaker
2011-02-09 18:48     ` Richard Riley
2011-02-09 22:23       ` Wes Hardaker
2011-02-09 23:27         ` Richard Riley
2011-02-09 20:17 ` Bruno Tavernier
2011-02-11 21:28   ` Robert Pluim
2011-02-14  2:25   ` Lars Ingebrigtsen
2011-02-14  7:45     ` David Edmondson
2011-02-14  8:34       ` Robert Pluim
2011-02-14  9:42     ` David Engster
2011-02-14 11:26       ` Richard Riley
2011-02-14 20:09         ` Lars Ingebrigtsen
2011-02-14 20:13           ` Lars Ingebrigtsen
2011-02-14 21:08             ` Ted Zlatanov
2011-02-14 21:23               ` Lars Ingebrigtsen
2011-02-16 16:12         ` Johnny [this message]
2011-02-16 16:28           ` Ted Zlatanov
2011-02-16 16:45             ` Johnny
2011-02-16 19:06               ` Ted Zlatanov
2011-02-16 20:41                 ` Johnny
2011-02-16 23:17                 ` Leo
2011-02-17 17:04                   ` Ted Zlatanov
2011-02-17 20:33                     ` Broken split-fancy upon updating gnus (Re: Multiple SMTP servers with Gnus?) Johnny
2011-02-17 22:38                       ` Lars Ingebrigtsen
2011-02-18 20:27                       ` Ted Zlatanov
2011-02-18 23:09                         ` Lars Ingebrigtsen
2011-02-21 20:25                           ` Ted Zlatanov
2011-02-19 10:54                         ` Johnny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3msarhq.fsf@gmx.co.uk \
    --to=yggdrasil@gmx.co.uk \
    --cc=ding@gnus.org \
    --cc=rileyrg@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).