emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: Sending org buffer as mail?


From: Eric Schulte
Subject: Re: [Orgmode] Re: Sending org buffer as mail?
Date: Thu, 16 Dec 2010 18:27:38 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi Matt,

This looks great, how would you feel about trying to fold this into
org-mime, or would you mind if I did so.  I've already mimicked your
function to set subjects of outgoing emails to match the title of the
org-mode buffer.  I think that generalizing the org-mime functions to
operate over either subtrees or whole files, and to output either html
or plain text should cover all use cases with maximal code re-use.

Thanks for sharing this function.

Cheers -- Eric

Matt Lundin <address@hidden> writes:

> Rainer M Krug <address@hidden> writes:
>
>> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>>> <address@hidden> wrote:
>>>> And then, I can send a org-file by attaching it to a mail in Emacs. Try
>>>> C-x m to start a new mail buffer, attach with C-c C-a and send with C-c
>>>> C-c.
>>
>> Sounds very interesting - I'll try it out.
>>
>> C-x m looks great - I am sure I am going to use it a lot. And gmail is
>> exactly what I want to use it for.
>>
>>> 
>>> Does this attach the buffer or read it into the message? I thought the
>>> OP wanted to read-in a buffer. 
>>
>> Yes - that was effectively what I am looking for: the possiblility to
>> write my email in org mode and send the buffer content as the email text.
>>
>> Dream: Specify subject, to, cc, bcc (probably even attachments) as
>> properties, press a key and the org file is send to the addresses.
>
> I too have been looking for this functionality for a while, so here's a
> quick solution. When called on an Org-mode subtree, the following
> function makes the headline the subject, exports the subtree to ascii,
> and uses properties ("MAIL_TO", "MAIL_CC", "MAIL_BCC") to specify the
> addressees:
>
> (defun my-org-subtree-to-message ()
>   (interactive)
>   (unless (eq major-mode 'org-mode)
>     (error "Not in org buffer"))
>   (let ((subject (nth 4 (org-heading-components)))
>       (to (org-entry-get nil "MAIL_TO"))
>       (cc (org-entry-get nil "MAIL_CC"))
>       (bcc (org-entry-get nil "MAIL_BCC"))
>       text)
>     (save-excursion 
>       (org-mark-subtree)
>       ;; don't include title in body
>       (forward-line)
>       (setq text (org-export-region-as-ascii (point)
>                                            (mark) t 'string)))
>     (message-mail to subject `((cc . ,cc) (bcc . ,bcc)) nil)
>     (when text 
>       (save-excursion
>       (goto-char (point-max))
>       (insert text)))))
>
> With this function, you can compose emails like this:
>
> * My obsequious missive
>   :PROPERTIES:
>   :MAIL_TO:  address@hidden
>   :MAIL_BCC:  address@hidden
>   :END:
> My most noble sirs,
>
> I thank you for gracing this world with your beauteous presence.
>
> Humbly yours,
> An Org-mode user
>
> Best,
> Matt
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

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