I am trying to use org-mime and particularly org-mime-subtree to compose messages in org-mode, send with mu4e, and finally save those messages in the /sent folder in my local maildir.
As I understand it, I should be able to do this in the following manner:
1. set mail-user-agent to mu4e-user-agent
(setq mail-user-agent 'mu4e-user-agent)
2. Go to the subtree and issue `M-x org-mime-subtree'
Unforrtunately, this fails with the error:
message-add-header: Wrong type argument: stringp, ((cc . "me@there") (bcc . "emacs@here"))
Org-mime creates the message buffer with the command org-mime-compose, which includes the line:
(compose-mail to subject headers nil)
Headers is a list of the form ((cc . ,cc) (bcc . ,bcc)). when mail-user-agent is set to 'message-user-agent, this ist is accepted as an argument, but 'mu4e-user-agent seems to expect a string instead.
Here's the relevant code from message-user-agent's message-mail, the analog of mu4e~compose-mail:
(message-setup
(nconc
`((To . ,(or to "")) (Subject . ,(or subject "")))
;; C-h f compose-mail says that headers should be specified as
;; (string . value); however all the rest of message expects
;; headers to be symbols, not strings (eg message-header-format-alist).
;;
http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00337.html ;; We need to convert any string input, eg from rmail-start-mail.
(dolist (h other-headers other-headers)
(if (stringp (car h)) (setcar h (intern (capitalize (car h)))))))
yank-action send-actions continue switch-function
return-action)
This is what is found in mu4e~compose-mail:
(when (message-goto-to) ;; reset to-address, if needed
(message-delete-line))
(message-add-header (concat "To: " to "\n"))
(when (message-goto-subject) ;; reset subject, if needed
(message-delete-line))
(message-add-header (concat "Subject: " subject "\n"))
;; add any other headers specified
(when other-headers
(message-add-header other-headers))
Should the final (message-add-header other-headers) be replaced with a loop that goes through the elements of other-headers?