Creating new draft from org-mode/org-contacts

38 views
Skip to first unread message

Henrik Frisk

unread,
Nov 28, 2017, 10:35:27 AM11/28/17
to mu-di...@googlegroups.com
Hi,

I've been following the recent thread on HTML mails from org-mode. I'm trying to change my workflow and would like to know if anyone has tried to create a new draft from org-contacts?

IOW from this entry, or a link to it:

* Mr Recipient
:PROPERTIES:
:EMAIL: r...@cxxx.se
:END:

I would get a new draft in mu4e.

Any hints to accomplish this would be appreciated. I can write som lisp, but I don't really know where to start, or if this is already possible.

Best,
Henrik

nils.s...@gmail.com

unread,
Nov 29, 2017, 5:11:31 AM11/29/17
to mu-discuss
Hi Henrik,

to do this, you will have to adapt the the function org-mime-org-buffer-htmlize() to mu4e requirements.
This function is supposed to do exactly what you want.
In the current org-mime version it looks like this:
(defun org-mime-org-buffer-htmlize ()
 
"Create an email buffer containing the current org-mode file
      exported to html and encoded in both html and in org formats as
      mime alternatives."

 
(interactive)
 
(save-excursion
   
(funcall org-mime-up-subtree-heading)
   
(cl-flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
     
(let* ((file (buffer-file-name (current-buffer)))
             
(subject (or (mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
             
(to (mp "MAIL_TO"))
             
(cc (mp "MAIL_CC"))
             
(bcc (mp "MAIL_BCC"))
             
;; Thanks for Matt Price improving handling of cc & bcc headers
             
(other-headers (cond
                             
((and cc bcc) `((cc . ,cc) (bcc . ,bcc)))
                             (cc `
((cc . ,cc)))
                             
(bcc `((bcc . ,bcc)))
                             (t nil)))
             (opts (if (fboundp 'org-export--get-subtree-options) (org-export--get-subtree-options)))
             (body (org-get-entry)))
        (org-mime-compose body file to subject other-headers opts)))))

The Properties are then
MAIL_SUBJECT:
MAIL_TO and so forth.

Compare it with my version of the function:
(defun org-mime-org-buffer-htmlize ()
 
"Create an email buffer containing the current org-mode file
      exported to html and encoded in both html and in org formats as
      mime alternatives."

 
(interactive)
 
(org-mime-send-buffer 'html)
  (message-goto-to))

The latter is not working with current-versions of org-mime.

To me it seems that the task is to find a way to use the newer org-mime version and to somehow integrate it with mu4e.

Greets,
Nils

Henrik Frisk

unread,
Nov 29, 2017, 3:20:20 PM11/29/17
to mu-di...@googlegroups.com
Hi Nils,

Thanks, this helps a lot. I will look inte this and see what I can come up with.

Best,
Henrik

--
You received this message because you are subscribed to the Google Groups "mu-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mu-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages