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

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

Re: sending a buffer by mail


From: Emanuel Berg
Subject: Re: sending a buffer by mail
Date: Thu, 07 Sep 2017 23:24:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Jean-Christophe Helary wrote:

> c-x m creates an empty mail buffer, but say
> I have a buffer that I need to send by mail,
> what magic command would do the trick?

You can send mail programmatically and in this
case it would amount to combining the below
code with a function that retrieves the buffer
contents, `buffer-string', perhaps?

But I suspect your use case is better benefited
from just opening a buffer with whatever
command you fancy for that - I use

    (gnus-post-news 'post "")

- and then simply yank the buffer into it!

But here is the code anyway:

(require 'cl-lib)
(require 'gnus-msg)
(require 'message)

(defun mail-to-many (to subject body)
  (cl-dolist (this-to to)
    (gnus-post-news 'post "")
    (message-goto-to)          (insert this-to)
    (message-goto-subject)     (insert subject)
    (message-goto-body)        (insert body)
    (message-send-and-exit) ))

Source: http://user.it.uu.se/~embe8573/emacs-init/gnus/mail-to-many.el

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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