From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Sending org buffer as mail? Date: Thu, 16 Dec 2010 20:06:31 -0500 Message-ID: <87bp4lxl60.fsf@fastmail.fm> References: <4D09C7F2.8020806@gmail.com> <87sjxy168c.fsf@gmail.com> <4D09D3BB.3020508@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=38690 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTOmK-0007a4-6k for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 20:06:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTOmI-0007Uv-TZ for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 20:06:35 -0500 Received: from out3.smtp.messagingengine.com ([66.111.4.27]:35025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTOmI-0007Uf-Qi for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 20:06:34 -0500 In-Reply-To: <4D09D3BB.3020508@gmail.com> (Rainer M. Krug's message of "Thu, 16 Dec 2010 09:54:19 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rainer M Krug Cc: Oscar Carlsson , Jeff Horn , emacs-orgmode@gnu.org Rainer M Krug writes: > On 12/16/2010 09:25 AM, Jeff Horn wrote: >> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson >> 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: --8<---------------cut here---------------start------------->8--- (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))))) --8<---------------cut here---------------end--------------->8--- With this function, you can compose emails like this: --8<---------------cut here---------------start------------->8--- * My obsequious missive :PROPERTIES: :MAIL_TO: highly_esteemed@gentlemen.net :MAIL_BCC: peasants_united@plebeians.org :END: My most noble sirs, I thank you for gracing this world with your beauteous presence. Humbly yours, An Org-mode user --8<---------------cut here---------------end--------------->8--- Best, Matt