info-gnus-english
[Top][All Lists]
Advanced

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

multiple smtp accounts (including gmail)


From: Peter Smerdon
Subject: multiple smtp accounts (including gmail)
Date: Fri, 04 Apr 2008 08:25:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hello list,

I am using Gnus v5.13 bundled with emacs-snapshot on Ubuntu. I use
fetchmail to download all my email and gnus to read it from ~/Mail

I found a snippet on the internet that helped me use gmail's smtp server
It uses the msmtp program.

,----
| (defun fs-change-smtp ()
|   "Change the SMTP server according to the current from line."
|   (save-excursion
|     (let ((from
|            (save-restriction
|              (message-narrow-to-headers)
|              (message-fetch-field "from"))))
|       (message "From is `%s', setting `smtpmail-smtp-server' to `%s'"
|                from
|                (cond
|                 ((string-match "psmerdon@gmail.com" from)
|                  (setq sendmail-program "msmtp"))
|                 (add-hook 'message-setup-hook 'fs-change-smtp))))))
`----

and then in my ~/.msmtprc

,----
| account default
| host smtp.gmail.com
| auth on
| user psmerdon@gmail.com
| password PASSWORD
| port 587
| tls on
| logfile ~/.msmtplog
`----

Now my job has set up an absolutely awful web based email system we all
have to use. However I found out that I can use pop3 and smtp which
means I can read and reply to work email in Gnus, fetchmail handles the
pop3 part with ease but I am having trouble adding a second smtp
server. I tried this in my .gnus.el

,----
| (defun fs-change-smtp ()
|   "Change the SMTP server according to the current from line."
|   (save-excursion
|     (let ((from
|            (save-restriction
|              (message-narrow-to-headers)
|              (message-fetch-field "from"))))
|       (message "From is `%s', setting `smtpmail-smtp-server' to `%s'"
|                from
|                (cond
|                 ((string-match "psmerdon@gmail.com" from)
|                  (setq sendmail-program "msmtp"))
|                 (add-hook 'message-setup-hook 'fs-change-smtp))
|                (cond
|                 ((string-match "psmerdon@northwindsolutions.com" from)
|                  (setq sendmail-program "msmtp"))
|                 (add-hook 'message-setup-hook 'fs-change-smtp))))))
`----

and then in my .msmtprc

,----
| account default
| host smtp.gmail.com
| auth on
| user psmerdon@gmail.com
| password PASSWORD
| port 587
| tls on
| logfile ~/.msmtplog
| 
| account northwind
| host smtp.northwindsolutions.com
| from psmerdon@northwindsolutions.com
| auth on
| user psmerdon@northwindsolutions.com
| password PASSWORD
| tls on
| port 5050
| logfile ~/.msmtplog
`----

I get no error messages, but I have no elisp skills to speak of so I am
not sure what I am doing wrong, anytime I reply to an email sent to my
northwind account, the From: header is not changed

Hopefully someone can help me? Is there a simpler way to do this btw? I
wonder if gnus can use multiple smtp servers directly without having to
use msmtp at all? 

Thank you in advance for any iput!

-- 

Peter.


reply via email to

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