emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/org-mime 2581fc2dd9 091/118: org-mime-confirm-when-no-mult


From: ELPA Syncer
Subject: [nongnu] elpa/org-mime 2581fc2dd9 091/118: org-mime-confirm-when-no-multipart function + docs
Date: Wed, 5 Jan 2022 07:58:49 -0500 (EST)

branch: elpa/org-mime
commit 2581fc2dd95a55ed797808f33b1596bc642cd188
Author: John Borwick <borwick@Greybeard.domain>
Commit: John Borwick <borwick@Greybeard.domain>

    org-mime-confirm-when-no-multipart function + docs
---
 README.org  |  8 ++++++++
 org-mime.el | 12 ++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/README.org b/README.org
index f53ebdec95..66890a1f89 100644
--- a/README.org
+++ b/README.org
@@ -149,6 +149,14 @@ ASCII export options:
 (setq org-mime-export-ascii 'utf-8)
     #+end_src
 
+** Prompt for confirmation if message has no HTML
+
+If you plan to run =org-mime-htmlize= on all your email, you may want a 
confirmation if it appears you're sending an email without multipart content. 
To do this, add a hook to =message-send-hook= to your init file:
+
+#+begin_src elisp
+(add-hook 'message-send-hook 'org-mime-confirm-when-no-multipart)
+#+end_src
+
 * Support legacy Emacs versions
 - 0.1.6 is the last version to support Emacs 24
 * Development
diff --git a/org-mime.el b/org-mime.el
index 28274c5f10..f2f29761dc 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -788,6 +788,18 @@ Following headline properties can determine the mail 
headers,
      (t
       (message "Can not find plain text mail.")))))
 
+(defun org-mime-confirm-when-no-multipart ()
+  "Prompts whether to send email if the buffer does not seem to be html-ized"
+  (let ((found-multipart (save-excursion
+                           (save-restriction
+                             (widen)
+                             (goto-char (point-min))
+                             (search-forward "<#multipart type=alternative>" 
nil t)))))
+    (when (and (not found-multipart)
+               (not (y-or-n-p "org-mime-htmlize not called; send anyway?")))
+      (setq quit-flag t))))
+
+
 (provide 'org-mime)
 ;; Local Variables:
 ;; coding: utf-8



reply via email to

[Prev in Thread] Current Thread [Next in Thread]