[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple sources and accounts with GNUS
From: |
Richard Riley |
Subject: |
Re: Multiple sources and accounts with GNUS |
Date: |
Mon, 20 Dec 2010 17:42:25 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux) |
Yuri D'Elia <wavexx@users.sf.net> writes:
> Hi everyone. After a long period with mutt (which indeed sucks less but
> doesn't do news) and sylpheed/claws (which just sucks), I'm back to
> GNUS. I'm a sadist underneath - I know.
>
> So far I was able to setup all the receiving accounts successfully (a
> couple of nnimap accounts, gmane via nntp, nnmaildir for local spools,
> etc), but I'm having trouble to send outgoing e-mails to different
> accounts depending on the current group.
>
> I'm fine with the default of using sendmail, but for a couple of IMAP
> groups I need to use a specific SMTP server with credentials.
>
> Could I use 'gnus-parameters' for that, and change
> 'message-send-mail-function' depending on the group? Any pointer or
> small example in how to do this?
>
> Thanks.
>
msmtp is your man.
,----
| ;; 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)
`----
My code above selects the msmtp profile to use based on the From
address which, im turn, is set by gnus-posting-styles but hopefully you
can adjust as appropriate.
Googling up the key vars above and msmtp should provide the info you
need.
- Re: Multiple sources and accounts with GNUS,
Richard Riley <=
- Re: Multiple sources and accounts with GNUS, Yuri D'Elia, 2010/12/21
- Re: Multiple sources and accounts with GNUS, Tassilo Horn, 2010/12/21
- Re: Multiple sources and accounts with GNUS, Yuri D'Elia, 2010/12/22
- Re: Multiple sources and accounts with GNUS, Tassilo Horn, 2010/12/22
- Re: Multiple sources and accounts with GNUS, Yuri D'Elia, 2010/12/22
- Re: Multiple sources and accounts with GNUS, Alberto Luaces, 2010/12/23
- Re: Multiple sources and accounts with GNUS, Tassilo Horn, 2010/12/23
Message not available