views:

96

answers:

2

I'd like to write a little emacs command to send an email. What's the simplest way to do this? I know there are a lot of mail-sending plugins for emacs, but I really just need to send a simple little email.

+2  A: 

C-x m is simple enough.

Deniz Dogan
That's true. But I was wanting to send it programmatically. It looks like compose-mail will bring up a new frame to compose the mail in.
Jason Baker
+5  A: 

This works nicely:

(defun try-send-email (to subject body)
  "simple wrapper around message to send an email"
  (message-mail to subject)
  (message-goto-body)
  (insert body)
  (message-send-and-exit))

It does use Gnus' message system (as opposed to the slightly simpler mail), but it does work in an Emacs w/out any configuration on my system.

Trey Jackson