summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <eric.schulte@gmx.com>2012-04-12 08:19:54 -0400
committerEric Schulte <eric.schulte@gmx.com>2012-04-12 08:21:05 -0400
commit165d34af6af29dc12fc8b8f643ff5c1d9552b2bc (patch)
tree998b70e37483de28285ef2e76c1c9e815a1f76b6
parent0202817e062eb98eb826a01cdecb9673a273cfc7 (diff)
downloadorg-mode-165d34af6af29dc12fc8b8f643ff5c1d9552b2bc.tar.gz
Revert "Revert "in emails, wrap html and images in a multipart/mixed structure""
This reverts commit 3f810ad424c675e18fc5072966780993af912149.
-rw-r--r--contrib/lisp/org-mime.el37
1 files changed, 23 insertions, 14 deletions
diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index 27c8ffd..fc333be 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -132,13 +132,13 @@ exported html."
(defun org-mime-file (ext path id)
"Markup a file for attachment."
(case org-mime-library
- ('mml (format
- "<#part type=\"%s\" filename=\"%s\" id=\"<%s>\">\n<#/part>\n"
- ext path id))
+ ('mml (format (concat "<#part type=\"%s\" filename=\"%s\" "
+ "disposition=inline id=\"<%s>\">\n<#/part>\n")
+ ext path id))
('semi (concat
- (format
- "--[[%s\nContent-Disposition: inline;\nContent-ID: <%s>][base64]]\n"
- ext id)
+ (format (concat "--[[%s\nContent-Disposition: "
+ "inline;\nContent-ID: <%s>][base64]]\n")
+ ext id)
(base64-encode-string
(with-temp-buffer
(set-buffer-multibyte nil)
@@ -146,17 +146,26 @@ exported html."
(buffer-string)))))
('vm "?")))
-(defun org-mime-multipart (plain html)
- "Markup a multipart/alternative with text/plain and text/html
- alternatives."
+(defun org-mime-multipart (plain html &optional images)
+ "Markup a multipart/alternative with text/plain and text/html alternatives.
+If the html portion of the message includes images wrap the html
+and images in a multipart/related part."
(case org-mime-library
- ('mml (format (concat "<#multipart type=alternative><#part type=text/plain>"
- "%s<#part type=text/html>%s<#/multipart>\n")
- plain html))
+ ('mml (concat "<#multipart type=alternative><#part type=text/plain>"
+ plain
+ (when images "<#multipart type=related>")
+ "<#part type=text/html>"
+ html
+ images
+ (when images "<#/multipart>\n")
+ "<#/multipart>\n"))
('semi (concat
"--" "<<alternative>>-{\n"
"--" "[[text/plain]]\n" plain
+ (when images (concat "--" "<<alternative>>-{\n"))
"--" "[[text/html]]\n" html
+ images
+ (when images (concat "--" "}-<<alternative>>\n"))
"--" "}-<<alternative>>\n"))
('vm "?")))
@@ -220,8 +229,8 @@ export that region, otherwise export the entire body."
(delete-region html-start html-end)
(save-excursion
(goto-char html-start)
- (insert (org-mime-multipart body html)
- (mapconcat 'identity html-images "\n")))))
+ (insert (org-mime-multipart
+ body html (mapconcat 'identity html-images "\n"))))))
(defun org-mime-apply-html-hook (html)
(if org-mime-html-hook