Microsoft 365のContent Searchなどでメールをダウンロードすると、MSG形式でダウンロードされる。MSGはMicrosoft Outlook向けのファイル形式で、Outlook以外のメールクライアントで開くことはできず、解析には少々不向き。
ので、.msgのメールを.emlに変換する方法をメモ。
.emlへの変換にはmsgconvertを使う。
インストール。
(sudo) apt-get install libemail-outlook-message-perl
使い方。
msgconvert <file.msg>
msgconvert --outfile <outfile> <file.msg>
--outfileが指定されなかった場合、.emlファイルが個別に作成される。
コマンドを実行して、Encode.c: loadable library and perl binaries are mismatched (got first handshake key 0xf380080みたいなエラーに遭遇した場合は、以下のunsetコマンドの後に、再度実行してみる。
unset PERL5LIB