From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jos'h Fuller Subject: Sending and archiving emails with capture... Date: Thu, 15 Mar 2012 17:22:02 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8I7m-0003MR-9r for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 17:22:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8I7k-0004Os-0G for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 17:22:17 -0400 Received: from mail.arcproductions.com ([206.191.120.230]:24485) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8I7j-0004Oh-R2 for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 17:22:15 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org, Jos'h.Fuller@arcproductions.com Hi! Assuming I've got everything set up correctly and this email makes it to the list, this is in response to Alan E. Davis' question about sending an email from Emacs and saving a copy in org-mode. I make the assumption here that your Emacs is set up to properly send emails using the ~mail~ command. Also note that my ~org-capture-templates~ setup has more than just an email template. Install the lines below just after your org-mode install. To use: - Invoke org-capture from any buffer with C-cc. - Choose the Mail template ([m] key). - Enter the recipient's address, then [enter]. - Enter the mail subject, then [enter]. - Your cursor is positioned at the start of the email. - Write your email. - C-c C-c sends it on its way! This is very crude and could certainly be improved. However, perhaps it's a reasonable starting point! Jos'h -- snip! -------------------------------------------------------------------- ;; Capture Setup (setq org-capture-templates (quote (("m" "Mail" entry (file+olp org-default-notes-file "Emails") "** Email %T From: Your Name To: %^{Send mail to} Subject: %^{Subject} --text follows this line-- %? _______________________________________________________________________________ This is a signature...") ("t" "todo" entry (file org-default-notes-file) "* TODO %?\n%U\n%a\n %i" :clock-in t :clock-resume t) ("n" "note" entry (file org-default-notes-file) "* %? :NOTE:\n%U\n%a\n %i" :clock-in t :clock-resume t) ("h" "Habit" entry (file org-default-notes-file) "* NEXT %?\n%U\n%a\nSCHEDULED: %t .+1d/3d\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n %i")))) (defun my-finalize-capture () "This is run from the org-capture-before-finalize hook just before the indirect buffer is closed. If the current local capture is a 'Mail' message, I extract it and send it on it's way. Because I am cautious, I extract the text from the org buffer and put it into a private temporary buffer before sending it as an email. This may not be the best way to do this..." (message "* Running custom finalize hook...") (if (string= "Mail" (org-capture-get :description)) (save-excursion (goto-char (org-capture-get :begin-marker t)) (next-line) ; Skip past org slug line. (let* ((msg (buffer-substring (point) (org-capture-get :end-marker t)))) (with-temp-buffer (insert msg) (mail-send) )) )) ) (add-hook 'org-capture-before-finalize-hook 'my-finalize-capture) (define-key global-map "\C-cc" 'org-capture) _______________________________________________________________________________ Jos'h Fuller, Production Programmer Arc Productions Ltd. p: 416.682.5237 | f: 416.682.5209 | http://www.arcproductions.com 230 Richmond Street East | Toronto, ON M5A 1P4 |