help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: SMTP library problem


From: Richard G Riley
Subject: Re: SMTP library problem
Date: Sun, 09 Mar 2008 18:26:31 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

David <de_bb@arcor.de> writes:

> Stephen Berman <Stephen.Berman@gmx.net> writes:
>> Ok, I set smtpmail-default-smtp-server to "localhost" and
>> smtpmail-auth-credentials to '(("localhost" 2000 "myusername"
>> "mypassword")), and indeed it did work -- almost.  Since the mail goes
>> through localhost, it gets picked up by the postfix server running on my
>> system.  
>
> You local postfix listens on another port (25), so it should not pick up
> the mail. You must have done something wrong in your smtpmail.el
> configuration. Here's how it should work:
>
> (setq smtpmail-default-smtp-server "localhost")
> (setq smtpmail-smtp-service 2000)
> (require 'smtpmail)
> (setq send-mail-function 'smtpmail-send-it)
> (setq message-send-mail-function 'smtpmail-send-it)
> (setq smtpmail-debug-info t)
> (setq smtpmail-auth-credentials
>       '(("localhost" 2000 "name" "pass")))
>
> Note that smtp-server and smtp-service are set before the 'require'
> (though I'm not sure if this is still necessary).
>
>> I have postfix configured to relay mail from localhost to
>> another server (mail.gmx.net), which is what I use for most of my
>> email.  
>
> I guess you could configure postfix to use different smart hosts
> dependent on the sender address, but I don't know postfix and it's
> OT here anyway.

I use msmtp for this.

,----
| (defun msmtp-change-smtp ()
|   
|  (setq sendmail-program "/usr/bin/msmtp")
|  (setq smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)))
|  (setq smtpmail-smtp-server "smtp.gmail.com")
|  (setq message-sendmail-envelope-from 'header)
| 
|   (if (message-mail-p)
|       (save-excursion
|       (let* ((from
|               (save-restriction
|                 (message-narrow-to-headers)
|                 (message-fetch-field "from")))
|              (account
|               (cond
|                ((string-match ".*rileyrgdev.*" from)"rileyrgdev")
*snip*
|                ))
|              )
|         (setq message-sendmail-extra-arguments (list "-a" account))
|         )))
|  )
| 
| 
| 
| (add-hook 'message-send-hook 'msmtp-change-smtp)
`----

and then, ~/.msmtp

,----
| defaults
| host smtp.gmail.com
| port 587
| auth on
| tls on
| tls_certcheck off
| logfile /tmp/msmtp.log
| 
| 
| account rileyrgdev
| user rileyrgdev@gmail.com
| password ******
| host myparticular.smtp.host
| from rileyrgdev@gmail.com
| 
| ** SNIP**
| 
| account default : rileyrgdev
`----


reply via email to

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