From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: batch mode to send an email Date: Mon, 07 Aug 2006 15:07:09 -0400 Message-ID: <44D78F5D.8080306@speakeasy.net> References: <44D7069F.7010105@speakeasy.net> Reply-To: gebser@speakeasy.net NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1154977752 31197 80.91.229.2 (7 Aug 2006 19:09:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 7 Aug 2006 19:09:12 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 07 21:09:09 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GAAS8-0001K4-QL for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Aug 2006 21:07:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAAS7-0001O6-P9 for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Aug 2006 15:07:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GAARw-0001M2-OL for help-gnu-emacs@gnu.org; Mon, 07 Aug 2006 15:07:40 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GAARv-0001LH-3o for help-gnu-emacs@gnu.org; Mon, 07 Aug 2006 15:07:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAARu-0001LE-Vl for help-gnu-emacs@gnu.org; Mon, 07 Aug 2006 15:07:39 -0400 Original-Received: from [69.17.117.9] (helo=mail7.sea5.speakeasy.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GAAWD-0003YE-4m for help-gnu-emacs@gnu.org; Mon, 07 Aug 2006 15:12:05 -0400 Original-Received: (qmail 7585 invoked from network); 7 Aug 2006 19:07:37 -0000 Original-Received: from dsl093-011-017.cle1.dsl.speakeasy.net (HELO [192.168.0.27]) (gebser@[66.93.11.17]) (envelope-sender ) by mail7.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 7 Aug 2006 19:07:36 -0000 User-Agent: Thunderbird 1.5.0.5 (X11/20060725) Original-To: GNU Emacs List In-Reply-To: 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:36560 Archived-At: Kevin Rodgers wrote: > ken wrote: >> Trying to get emacs to send an email. I've heard other people have >> gotten this to work and have even been using it. So I'm hoping I won't >> have to upgrade anything to accomplish this. >> >> I've read a lot of documentation on sending email with emacs. But what >> has been hinted at there hasn't yet worked for me (in many years). >> (Yeah, I used to use gnus, but switched long ago... another story, >> irrelevant here.) >> >> To eliminate the possibility of misconfiguration in ~/.emacs, I'm >> calling the elisp file from a tiny bash script. I.e., if the >> documentation on using emacs in batch mode is correct, ~/.emacs is not >> read when emacs is called in batch mode. > > That is correct. > >> To lower the bar for emacs as far as possible, at this point in >> development I'm only asking the elisp script to send something-- >> anything at all, even garbage-- to port 25 on a server we'll call >> mail.server.tld. That is, at this point it doesn't have to (though it >> may and eventually must) specify a local user, a destination email >> address, subject line and other headers, body of the email. In order to >> eliminate as much as possible any misconfiguration which would cause the >> entire elisp script not to work, at this point I'm only trying to get >> emacs to do the very first, very smallest step in sending an email in >> batch mode. If emacs needs to do more than this in order to function at >> all, that's fine. I'm just trying to keep things as absolutely simple >> as possible. I'll be delighted if emacs does something that even >> remotely looks like sending an email. > > (setq send-mail-function 'smtpmail-send-it > smtpmail-smtp-server "mail.server.tld") > > (setq mail-default-headers > "X-RTFM: Sending Mail; Mail Sending; (smtpmail)Emacs Speaks SMTP\n") > > (mail nil "someuser@somewhere.somedomain" "my favorite subject") > > (insert "Blah, blah, blah.\n") > > (mail-send-and-exit) > Kevin, Thanks very much for your reply. But it didn't work. All I did was change the destination email address and the mail server to actual, existing values. The error I got was: Wrong number of arguments: #[(arg) ("/usr/share/emacs/21.3/lisp/mail/sendmail.elc" . 21146) nil 2 ("/usr/share/emacs/21.3/lisp/mail/sendmail.elc" . 20985) "P"], 0 (all on one line, of course. My mail client autowraps.) I commented out ''(mail nil ....)'' and the error went away. "C-h f mail" says there can be more args, but doesn't say it must. I'm not certain how to fix this line.