LoginSignup
2

More than 5 years have passed since last update.

WanderlustでContent-Transfer-Encoding: base64なメールを見る方法

Last updated at Posted at 2017-02-10

背景

私はメールを読むのは主にEmacs + Wanderlustなんですが、たまに本文がうまく読めないメールが来ます。
中身を見てみると、

Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

というメールでした。Outlookなんかがこの形で送信するのかな?

設定

以下を ~/.wl に追加しましょう。

(require 'mime-def)
(mel-define-method mime-decode-string (string (nil "base64"))
  (condition-case error
      (base64-decode-string string)
    (error
     (catch 'done
       (when (string-match
              "\\([A-Za-z0-9+/ \t\r\n]+\\)=*" string)
         (let ((tail (substring string (match-end 0)))
               (string (match-string 1 string)))
           (dotimes (i 3)
             (condition-case nil
                 (progn
                   (setq string (base64-decode-string string))
                   (throw 'done (concat string tail)))
               (error))
             (setq string (concat string "=")))))
       (signal (car error) (cdr error))))))

以上。

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2