From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard G Riley Newsgroups: gmane.emacs.help Subject: Re: SMTP library problem Date: Sun, 09 Mar 2008 18:26:31 +0100 Organization: A noiseless patient Spider Message-ID: References: <954cc8bb0803041009pda5f74aq23323b1e9dc4e85b@mail.gmail.com> <87zltdwhl7.fsf@escher.local.home> <87tzjlvtzs.fsf@escher.local.home> <87r6eo1zht.fsf@escher.local.home> <87r6emtxts.fsf@escher.local.home> <87skz2gpix.fsf@escher.local.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1205084447 18157 80.91.229.12 (9 Mar 2008 17:40:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Mar 2008 17:40:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 09 18:41:15 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JYPWG-0002px-22 for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Mar 2008 18:41:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYPVh-0005FC-QQ for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Mar 2008 13:40:33 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!feeder.news-service.com!feeder.news-service.com!news.motzarella.org!motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 86 Original-X-Trace: feeder.motzarella.org U2FsdGVkX183tQQFD+g5DXOR3abjofbhtoYsuxG18SHfrLgK9/13a4PnSWKs97G52vaTZagV8xYU5Iv1ipR+/Gf3L3lAwrdJMH1zi8FQDMimpkKmwWJ5pyg4u8JManvAwjn9BAxcaRjZzpl28TgrZg== Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Sun, 9 Mar 2008 17:26:35 +0000 (UTC) X-Auth-Sender: U2FsdGVkX19bknVy/plOtJ0Vx7JaRL77LYSAUVWk3m4j8qpgZDYPRQ== Cancel-Lock: sha1:hH8YuTRYkFmAj5s9CPG/atUybY0= User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux) Original-Xref: shelby.stanford.edu gnu.emacs.help:156819 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:52191 Archived-At: David writes: > Stephen Berman 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 `----