branch: elpa/org-mime
commit 470808cc14bddd61e2229358443856b793a979bd
Author: Nick Anderson <[email protected]>
Commit: Nick Anderson <[email protected]>
Added support for MAIL_FROM property
---
org-mime.el | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/org-mime.el b/org-mime.el
index 0d9add81c6..0fb34a3954 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -43,13 +43,14 @@
;;
;; `org-mime-org-subtree-htmlize' is similar to `org-mime-org-buffer-htmlize'
;; but works on current subtree. It can read following subtree properties:
-;; MAIL_SUBJECT, MAIL_TO, MAIL_CC, and MAIL_BCC.
+;; MAIL_SUBJECT, MAIL_TO, MAIL_FROM, MAIL_CC, and MAIL_BCC.
;;
;; Here is the sample of a subtree:
;; * mail one
;; :PROPERTIES:
;; :MAIL_SUBJECT: mail title
;; :MAIL_TO: [email protected]
+;; :MAIL_FROM: [email protected]
;; :MAIL_CC: [email protected]
;; :MAIL_BCC: [email protected]
;; :END:
@@ -479,16 +480,20 @@ If SUBTREEP is t, curret org node is subtree."
(message "Warning: org-element-map is not available. File keywords will
not work.")
'())))
-(defun org-mime-build-mail-other-headers (cc bcc)
- "Build mail header from CC and BCC."
+(defun org-mime-build-mail-other-headers (cc bcc from)
+ "Build mail header from CC, BCC, and FROM."
(cond
- ((and cc bcc)
+ ((and cc bcc from)
(list (cons "Cc" cc)
- (cons "Bcc" bcc)))
+ (cons "Bcc" bcc)
+ (cons "From" from)
+ ))
(cc
(list (cons "Cc" cc)))
(bcc
(list (cons "Bcc" bcc)))
+ (from
+ (list (cons "From" from)))
(t
nil)))
@@ -503,6 +508,7 @@ The following file keywords can be used to control the
headers:
#+MAIL_SUBJECT: a subject line
#+MAIL_CC: [email protected]
#+MAIL_BCC: [email protected]
+#+MAIL_FROM: [email protected]
The cursor ends in the TO field."
(interactive)
@@ -520,7 +526,8 @@ The cursor ends in the TO field."
(to (cdr (assoc "MAIL_TO" keywords)))
(cc (cdr (assoc "MAIL_CC" keywords)))
(bcc (cdr (assoc "MAIL_BCC" keywords)))
- (other-headers (org-mime-build-mail-other-headers cc bcc)))
+ (from (cdr (assoc "MAIL_FROM" keywords)))
+ (other-headers (org-mime-build-mail-other-headers cc bcc from)))
(org-mime-compose exported file to subject other-headers nil)
(message-goto-to)))
@@ -543,6 +550,7 @@ Following headline properties can determine the mail
headers,
:MAIL_TO: [email protected]
:MAIL_CC: [email protected]
:MAIL_BCC: [email protected]
+ :MAIL_FROM: [email protected]
:END:
"
(interactive "P")
@@ -562,8 +570,9 @@ Following headline properties can determine the mail
headers,
(to (org-mime-attr "MAIL_TO"))
(cc (org-mime-attr "MAIL_CC"))
(bcc (org-mime-attr "MAIL_BCC"))
+ (from (org-mime-attr "MAIL_FROM"))
;; Thanks to Matt Price improving handling of cc & bcc headers
- (other-headers (org-mime-build-mail-other-headers cc bcc))
+ (other-headers (org-mime-build-mail-other-headers cc bcc from))
(org-export-show-temporary-export-buffer nil)
(subtree-opts (when (fboundp 'org-export--get-subtree-options)
(org-export--get-subtree-options)))