Exchange mutilation of multipart/encrypted

Brian Sniffen bsniffen at akamai.com
Mon Dec 1 11:28:24 PST 2014


My employer uses an Exchange server in place of an MTA.  It mutilates
multipart/encrypted messages, so that when I receive a PGP/MIME message
the Emacs-notmuch interface shows me:

    [ multipart/mixed ]
    [ text/plain ]
    [ ATT00002: application/pgp-encrypted ]
    [ msg.asc: application/octet-stream ]

When I used Gnus heavily, I wrote a little program to un-mutilate
PGP/MIME mail:

~~~
(defun repair-multipart-encrypted (article)
  "Switch a multipart/mixed header to multipart/encrypted.
This helps cope with broken Exchange servers."
  (interactive (list (gnus-summary-article-number)))
  (gnus-with-article article
    (message-narrow-to-head)
    (goto-char (point-min))
    (search-forward "Content-Type")
    (search-forward "mixed")
    (replace-match "encrypted; protocol=\"application/pgp-encrypted\"" t t)
    (widen))
  (let (gnus-mark-article-hook)
    (gnus-summary-select-article t t nil article)))
~~~

I'd love to have a way to tell Emacs-notmuch to treat a part as of a
different type, and provide parameters.  Alternately, I'd be happy to
edit the file on disk and have it re-indexed---but that seems likely to
cause me regret.  Any advice?  I see
`notmuch-show-insert-bodypart-internal` and expect to call that
with a forced content-type.

Thanks,
Brian

-- 
Brian Sniffen
"I reserve the right to evolve my views, and state that views I previously
 expressed may have been somehere along the spectrum from insufficiently
 nuanced through ill-informed to dead wrong."


More information about the notmuch mailing list