I keep track of my activity in an org-file. The latest status is always under the heading "Current" which I usually just cut and paste into IRC for our weekly meetings. However we are now asked to send the status out ahead of time as an email. I'm trying to work out the best way to create a draft email based on the contents of the an org subtree. Currently I have a babel snippet that will fill the kill-ring but that seems a little hackish. It would be nice to create a complete draft together with address and subject lines.

  • If the answer below doesn't solve your problem, please provide more information so that I can update my answer.
    – user2005
    Commented Nov 11, 2014 at 15:48
  • @rekado: I was looking to re-use the existing mu4e email template rather than creating the message from scratch. I guess I wanted to programitically achieve the same as pressing "C" in the mu4e main window
    – stsquad
    Commented Nov 11, 2014 at 16:00
  • 1
    In that case you can use compose-mail; see my updated answer.
    – user2005
    Commented Nov 11, 2014 at 22:18

2 Answers 2


You could write a function that copies the subtree to the kill ring, creates a new buffer in message-mode, inserts a couple of lines and pastes the contents of the kill ring, like so:

(defun my-status-as-email ()

  ;; TODO: copy org subtree to kill ring
  ;; ...

  (set-buffer (get-buffer-create "*draft*"))
  (insert "From: me\n")
  (insert "To: you\n")
  (insert "Subject: my status\n")
  (insert "--text follows this line--\n")
  (pop-to-buffer-same-window (current-buffer)))

Alternatively and more elegantly, use compose-mail:

  (compose-mail "[email protected]" "my subject")
  (insert "my awesome summary:")

I'm accepting @rekado's answer as he got me there. But here is the org-babel snippet I'm now using for sake of completeness:

#+name: draft-status-email
#+begin_src emacs-lisp 
    (let ((end-of-week
            (shell-command-to-string "date --date='09:00 next Fri' +'%b. %e %Y'"))))
        (goto-char (point-min))
        (re-search-forward "** Current")
        (insert (format "** Team Email %s\n" (format-time-string "%e/%m/%Y"))))
       "[email protected]"
       (format "[weekly] week ending %s" end-of-week)
      (insert "Summary of activity:\n")
      (yank 2))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.