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

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

Re: batch mode to send an email


From: Kevin Rodgers
Subject: Re: batch mode to send an email
Date: Mon, 07 Aug 2006 09:23:31 -0600
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)

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





reply via email to

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