LoginSignup
12
18

More than 5 years have passed since last update.

PostFixの送信済みメールの中身を確認する時にやったこと

Posted at

既存システムで配信しているメールの内容を確認したかった。
とりあえず開発サーバーには入れる状況でメールを確認するまでにやったことをメモ :writing_hand_tone2:

あとで勉強しなおす・・・予定 :hugging:

PostFixの送信済みメールの中身を確認する時にやったこと

痕跡をさがす

$ tail -f /var/log/maillog

痕跡はあった。
ファイルがどこに出力されているか探す

$ postconf | grep home_mailbox
home_mailbox = Maildir/

/home/ユーザー名/Maildir/
に出てるらしい。

$ ls /home/tcimail/Maildir/new/
0000000.XXXXXXXXXXXXXXXXX.xxxx

new の中にそれらしきファイルを発見!

見てみる。

$ cat /home/tcimail/Maildir/new/0000000.XXXXXXXXXXXXXXXXX.xxxx

文字化けしまくり。。 :skull:

ただし文字化けしていない情報を発見!

0000000.XXXXXXXXXXXXXXXXX.xxxx(メールの痕跡と思われるファイル)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Content-Transfer-Encoding: quoted-printable
なので、nkf -mQでデコードして、nkf -wでUTF-8で出力する

$ cat 0000000.XXXXXXXXXXXXXXXXX.xxxx | nkf -mQ | nkf -w

見れたよー :thumbsup_tone2:

(参考)
MIMEエンコードされたメールのデコード方法
nkf - コマンド (プログラム) の説明 - Linux コマンド集 一覧表

12
18
0

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
12
18