in emails, wrap html and images in a multipart/mixed structure
* contrib/lisp/org-mime.el (org-mime-file): Mark images included as part of html portions as "disposition=inline". (org-mime-multipart): When images are present wrap html and images in a multipart/mixed structure. (org-mime-htmlize): When images are present wrap html and images in a multipart/mixed structure.
This commit is contained in:
parent
49645b6014
commit
718fefa4e3
|
@ -132,12 +132,12 @@ exported html."
|
||||||
(defun org-mime-file (ext path id)
|
(defun org-mime-file (ext path id)
|
||||||
"Markup a file for attachment."
|
"Markup a file for attachment."
|
||||||
(case org-mime-library
|
(case org-mime-library
|
||||||
('mml (format
|
('mml (format (concat "<#part type=\"%s\" filename=\"%s\" "
|
||||||
"<#part type=\"%s\" filename=\"%s\" id=\"<%s>\">\n<#/part>\n"
|
"disposition=inline id=\"<%s>\">\n<#/part>\n")
|
||||||
ext path id))
|
ext path id))
|
||||||
('semi (concat
|
('semi (concat
|
||||||
(format
|
(format (concat "--[[%s\nContent-Disposition: "
|
||||||
"--[[%s\nContent-Disposition: inline;\nContent-ID: <%s>][base64]]\n"
|
"inline;\nContent-ID: <%s>][base64]]\n")
|
||||||
ext id)
|
ext id)
|
||||||
(base64-encode-string
|
(base64-encode-string
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
@ -146,17 +146,26 @@ exported html."
|
||||||
(buffer-string)))))
|
(buffer-string)))))
|
||||||
('vm "?")))
|
('vm "?")))
|
||||||
|
|
||||||
(defun org-mime-multipart (plain html)
|
(defun org-mime-multipart (plain html &optional images)
|
||||||
"Markup a multipart/alternative with text/plain and text/html
|
"Markup a multipart/alternative with text/plain and text/html alternatives.
|
||||||
alternatives."
|
If the html portion of the message includes images wrap the html
|
||||||
|
and images in a multipart/related part."
|
||||||
(case org-mime-library
|
(case org-mime-library
|
||||||
('mml (format (concat "<#multipart type=alternative><#part type=text/plain>"
|
('mml (concat "<#multipart type=alternative><#part type=text/plain>"
|
||||||
"%s<#part type=text/html>%s<#/multipart>\n")
|
plain
|
||||||
plain html))
|
(when images "<#multipart type=related>")
|
||||||
|
"<#part type=text/html>"
|
||||||
|
html
|
||||||
|
images
|
||||||
|
(when images "<#/multipart>\n")
|
||||||
|
"<#/multipart>\n"))
|
||||||
('semi (concat
|
('semi (concat
|
||||||
"--" "<<alternative>>-{\n"
|
"--" "<<alternative>>-{\n"
|
||||||
"--" "[[text/plain]]\n" plain
|
"--" "[[text/plain]]\n" plain
|
||||||
|
(when images (concat "--" "<<alternative>>-{\n"))
|
||||||
"--" "[[text/html]]\n" html
|
"--" "[[text/html]]\n" html
|
||||||
|
images
|
||||||
|
(when images (concat "--" "}-<<alternative>>\n"))
|
||||||
"--" "}-<<alternative>>\n"))
|
"--" "}-<<alternative>>\n"))
|
||||||
('vm "?")))
|
('vm "?")))
|
||||||
|
|
||||||
|
@ -220,8 +229,8 @@ export that region, otherwise export the entire body."
|
||||||
(delete-region html-start html-end)
|
(delete-region html-start html-end)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char html-start)
|
(goto-char html-start)
|
||||||
(insert (org-mime-multipart body html)
|
(insert (org-mime-multipart
|
||||||
(mapconcat 'identity html-images "\n")))))
|
body html (mapconcat 'identity html-images "\n"))))))
|
||||||
|
|
||||||
(defun org-mime-apply-html-hook (html)
|
(defun org-mime-apply-html-hook (html)
|
||||||
(if org-mime-html-hook
|
(if org-mime-html-hook
|
||||||
|
|
Loading…
Reference in New Issue