1
0

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.

mailx で 日本語を含むファイルの中身をメールの本文として送信する方法(バイナリの添付ファイル化防止)

Last updated at Posted at 2019-03-21

はじめに

日本語を含むファイルを本文にしてメール送信しようとすると、バイナリファイルが添付されてメール送信されてしまいます。今回は、この現象を回避する方法を紹介します。

環境変数の設定

環境変数に LC_CTYPE を 設定してください。

export LC_CTYPE=ja_JP.UTF-8

送信コマンド

nkf コマンドで改行コードを LF に 変換した後に、メール送信してください。

# -d で LF 変換
nkf -d ファイル名 | mail メールアドレス

# UTF-8 のファイルでなければ -w で UTF-8 に 変換
nkf -w -d ファイル名 | mail メールアドレス
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?