2 Commits

Author SHA1 Message Date
  Daniel 5348856628
Only convert LF to CRLF when encrypting with S/MIME 1 month ago
  Daniel b0a3808973
Fix comment on LF → CRLF conversion after signing with S/MIME 1 month ago
1 changed files with 15 additions and 3 deletions
  1. 15
    3
      init.el

+ 15
- 3
init.el View File

@@ -1750,11 +1750,23 @@
1750 1750
   :config (progn
1751 1751
             ;; Outlook seems to expect \r\n in PKCS#7 encrypted containers, but
1752 1752
             ;; Gnus is only sending \n; so let's artificially replace \n by \r\n
1753
-            ;; before, well, signing?  Seems to work at least in the case where
1754
-            ;; we are sending S/MIME encrypted and signed messages.
1753
+            ;; after, well, signing?  But only if we are encrypting with S/MIME,
1754
+            ;; as otherwise the search for \n\n in `message-encode-message-body'
1755
+            ;; will break.  However, I think this is not the right way to do it
1756
+            ;; … isn't there some way to specify the encoding of the the
1757
+            ;; relevant MML buffers to be some nasty cp1252 or something?
1758
+
1759
+            ;; A previous version of this worked, but the following has not been
1760
+            ;; tested with Outlook proper.
1761
+
1762
+            (defun db/smime-add-crlf-when-pkcs7 (cont)
1763
+              "If CONT signifies encryption with smime, replace all \n with \r\n."
1764
+              (when (and (eq (car cont) 'part)
1765
+                         (string= "smime" (or (cdr (assq 'encrypt cont)) "")))
1766
+                (db/convert-lf-to-crlf-in-buffer)))
1755 1767
 
1756 1768
             (advice-add 'mml-smime-epg-sign
1757
-                        :after #'db/convert-lf-to-crlf-in-buffer) ))
1769
+                        :after #'db/smime-add-crlf-when-pkcs7)))
1758 1770
 
1759 1771
 ;; Archiving
1760 1772
 

Loading…
Cancel
Save