Bläddra i källkod

org-mime: now possible to set mail subjects using the mail_subject property

Eric Schulte 14 år sedan
förälder
incheckning
e612d0b9ff
1 ändrade filer med 16 tillägg och 15 borttagningar
  1. 16 15
      contrib/lisp/org-mime.el

+ 16 - 15
contrib/lisp/org-mime.el

@@ -235,21 +235,22 @@ export that region, otherwise export the entire body."
   (save-restriction
     (org-narrow-to-subtree)
     (run-hooks 'org-mime-send-subtree-hook)
-    (let* ((file (buffer-file-name (current-buffer)))
-	   (subject (nth 4 (org-heading-components)))
-	   (to (org-entry-get nil "MAIL_TO" org-mime-use-property-inheritance))
-	   (cc (org-entry-get nil "MAIL_CC" org-mime-use-property-inheritance))
-	   (bcc (org-entry-get nil "MAIL_BCC" org-mime-use-property-inheritance))
-	   (body (buffer-substring
-		  (save-excursion (goto-char (point-min))
-				  (forward-line 1)
-				  (when (looking-at "[ \t]*:PROPERTIES:")
-				    (re-search-forward ":END:" nil)
-				    (forward-char))
-				  (point))
-		  (point-max))))
-      (org-mime-compose body (or fmt 'org) file to subject
-			`((cc . ,cc) (bcc . ,bcc))))))
+    (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"))
+	     (body (buffer-substring
+		    (save-excursion (goto-char (point-min))
+				    (forward-line 1)
+				    (when (looking-at "[ \t]*:PROPERTIES:")
+				      (re-search-forward ":END:" nil)
+				      (forward-char))
+				    (point))
+		    (point-max))))
+	(org-mime-compose body (or fmt 'org) file to subject
+			  `((cc . ,cc) (bcc . ,bcc)))))))
 
 (defun org-mime-send-buffer (&optional fmt)
   (run-hooks 'org-mime-send-buffer-hook)