2

I receive GnuPG-encrypted (and signed) e-mails through an MS Exchange server. Unfortunately, the exchange server messes up the GPG format, such that mu4e cannot decrypt correctly.

This is a known issue with MS Exchange servers. For instance, Thunderbird-Enigmail pops up a message, "do you want to repair this message", and offers to repair the message. This changes some MIME headers and contents, and then the e-mail can be decrypted correctly.

I wrote a small Python script, which makes similar changes to files containing e-mails in a Maildir directory, which is synced with an IMAP server via offlineimap.

Now, whenever I open an encrypted e-mail in mu4e that cannot be encrypted, I want to run the Python script on the corresponding file, and then re-load it. How can I do this in Emacs Lisp?

Or, is there any other, simple solution to mimic the behaviour of Thunderbird's Enigmail plugin to repair e-mails messed up by Exchange servers?

Drew
  • 75,699
  • 9
  • 109
  • 225
user64060
  • 45
  • 3

1 Answers1

2

From the view buffer press a R and see if that works for you.

(defun mu4e-repair-file (msg)
  (let ((path (mu4e-message-field msg :path))
        (maildir (mu4e-message-field msg :maildir)))
    (shell-command (format "yourscript %s" path))
    (mu4e-refresh-message path maildir)))

(add-to-list 'mu4e-view-actions
             '("Repair file" . mu4e-repair-file))
jagrg
  • 3,824
  • 4
  • 19