82
78

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MIMEエンコードされたメールのデコード方法

Last updated at Posted at 2016-02-25

メール本文のデコード

まずgmailの"メッセージのソースを表示する"をクリックする。そしてメール本文をコピーする。

encodingがbase64でcharsetがUTF-8の場合

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

pbpaste | nkf -mB

encodingが7bitで、charsetISO-2022-JPの場合

Content-Type: text/plain; charset="ISO-2022-JP"
Content-Transfer-Encoding: 7bit

pbpaste | nkf -J でデコード

encodingがquoted-printableで、charsetがUTF-8の場合

Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

pbpaste | nkf -mQ でデコード

encodingがbase64で、charsetがISO-2022-JPの場合

charset=ISO-2022-JP
Content-Transfer-Encoding: base64

pbpaste | base64 -D | nkf -Jpbpaste | nkf -mB でデコード

encodingが8bitで、charsetがShift_JISの場合

content-type:text/plain; charset="Shift_JIS"
content-transfer-encoding:8bit

gmailのエンコードをShift_JISにする。

Subject(件名)のデコード

ISO-2022-JP、quoted-printable

Subject: =?ISO-2022-JP?Q?iTunes_Movie_=1B$B%K%e!<%j%j!<%9$HCmL\:nIJ=1B(B?=

echo "=?ISO-2022-JP?Q?iTunes_Movie_=1B$B%K%e!<%j%j!<%9$HCmL\:nIJ=1B(B?=" | nkf -m でデコード

ISO-2022-JP、BASE64

Subject: =?ISO-2022-JP?B?GyRCJUElMSVDJUg5WEZ+JE4bKEI=?=
 =?ISO-2022-JP?B?GyRCJCpDTiRpJDshSiVmJUolJCVGJUMlSSEmJTclTSVeGyhCIA==?=
 =?ISO-2022-JP?B?GyRCJTAlayE8JVchSxsoQg==?=

echo "Subject: =?ISO-2022-JP?B?GyRCJUElMSVDJUg5WEZ+JE4bKEI=?==?ISO-2022-JP?B?GyRCJCpDTiRpJDshSiVmJUolJCVGJUMlSSEmJTclTSVeGyhCIA==?==?ISO-2022-JP?B?GyRCJTAlayE8JVchSxsoQg==?=" | nkf -m でデコード

改行を含んでいる状態で pbpaste | nkf -m でもデコードできる。

UTF-8、BASE64

Subject: =?UTF-8?B?44CQ44OX44Op44Kk44Og5Lya5ZOh44Gu5pa5?=
 =?UTF-8?B?44G444GK55+l44KJ44Gb44CRUHJp?=
 =?UTF-8?B?bWUgTm93IOOCqOODquOCouaLoeWkpyjmnbHkuqzjg7vljYPokYkp?=

pbpaste | nkf -m でデコード

UTF-8、quoted-printable

Subject: =?utf-8?Q?Distributed=20TensorFlow=E3=81=AE=E8=A9=B1?=

pbpaste | nkf -m でデコード

82
78
1

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
82
78

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?