From: Richard Riley <rileyrg@googlemail.com>
To: ding@gnus.org
Subject: Re: Multiple SMTP servers with Gnus?
Date: Wed, 09 Feb 2011 18:46:59 +0100 [thread overview]
Message-ID: <qei7hyub0.fsf@news.eternal-september.org> (raw)
In-Reply-To: <pknlj1pyunq.fsf@this.is.really.invalid> (Robert Pluim's message of "Wed, 09 Feb 2011 18:39:21 +0100")
Robert Pluim <rpluim@gmail.com> writes:
> Hi,
>
> I currently have one SMTP server I talk to with Gnus, and another
> account with a web-mail interface that also supports SMTP. I'm
> considering just using Gnus for both, but I was wondering what the
> canonical method was for configuring this? gnus-posting-styles would
> theoretically fit, but I can't see any way to set any of the smtpmail
> variables in a posting style.
>
> Thanks
>
> Robert
>
My preferred way is msmtp. There is some junk in the msmtp-change-smtp
function below but its all so hairy to set up I wont touch it anymore ;)
It bases the msmtp account to use on the from address.
Hope it suits.
,----
| msmtp-name-list is a variable defined in `rgr-misc.gpg'.
| Its value is
| ("root" "richardriley" "riley" "shamrock")
`----
,----
| ;; Select the correct smtp server based on the from address.
| (defun msmtp-account (&optional def)
| (let* ((from
| (save-restriction
| (message-narrow-to-headers)
| (message-fetch-field "From")))
| (account (if from (catch 'match
| (dolist (element msmtp-name-list)
| ;; (message (format "smpt chosen is %s" element))
| (when (string-match (format ".*%s.*" element) from)
| (throw 'match element)))) nil)))
| (if account account (if def def "default"))))
|
| (defun msmtp-change-smtp ()
| (setq sendmail-program "/usr/bin/msmtp")
| (setq smtpmail-starttls-credentials '(("smtp.googlemail.com" 587 nil nil)))
| (setq smtpmail-smtp-server "smtp.googlemail.com")
| (setq message-sendmail-envelope-from 'header)
| (if (message-mail-p)
| (setq message-sendmail-extra-arguments (list "-a" (msmtp-account "default")))))
| (add-hook 'message-send-hook 'msmtp-change-smtp)
|
|
`----
Where my .msmtprc file is of the form
,----
| defaults
| host smtp.gmail.com
| port 587
| auth on
| tls on
| tls_certcheck off
| logfile /tmp/msmtp.log
|
| account riley
| user rileyrg@googlemail.com
| password *****
| from rileyrg@googlemail.com
|
| account richardriley
| host smtp.richardriley.net
| port 25
| user rgr
| password **************
| from rgr@richardriley.com
|
| account shamrock
| port 25
| user shamrockirishbar
| password ********
| from shamrock@shamrockirishbar.com
|
`----
--
☘ http://www.shamrockirishbar.com, http://splash-of-open-sauce.blogspot.com/ http://www.richardriley.net
next prev parent reply other threads:[~2011-02-09 17:46 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 [this message]
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
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=qei7hyub0.fsf@news.eternal-september.org \
--to=rileyrg@googlemail.com \
--cc=ding@gnus.org \
/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).