質問

したい添付ファイルmailxクセスがいい。

こちらは自分のコード:

subject="Something happened"
to="somebody@somewhere.com"
body="Attachment Test"
attachment=/path/to/somefile.csv

uuencode $attachment | mailx -s "$subject" "$to" << EOF

The message is ready to be sent with the following file or link attachments:

somefile.csv

Note: To protect against computer viruses, e-mail programs may prevent
sending or receiving certain types of file attachments.  Check your
e-mail security settings to determine how attachments are handled.

EOF

フィードバックがいただければ幸いです。


更新 また、添付varする必要性を回避するためのパス。

役に立ちましたか?

解決

まconcatのテキストのメッセージのuuencodedアタッチメント:

$ subject="Something happened"
$ to="somebody@somewhere.com"
$ body="Attachment Test"
$ attachment=/path/to/somefile.csv
$
$ cat >msg.txt <<EOF
> The message is ready to be sent with the following file or link attachments:
>
> somefile.csv
>
> Note: To protect against computer viruses, e-mail programs may prevent
> sending or receiving certain types of file attachments.  Check your
> e-mail security settings to determine how attachments are handled.
>
> EOF
$ ( cat msg.txt ; uuencode $attachment somefile.csv) | mailx -s "$subject" "$to"

が異なる方法を提供するメールの本文、この、あくまで目安ですが、例えば、現するために、欠かすことのできるオリジナルの質問です。場合はメッセージを再利用することは、あってはならないことでも大切に保管してくだファイルはこのダイアログにあります。

他のヒント

でも、最初の数問題になった.

  1. まれると仮定するとメールクライアントは扱うuuencoded添付せずンターフェースの通称です。ることをすることができない。

  2. い誤用I/Oリダイレクション:uuencodeの出力のヒアドキュメントが存在していたと考えられている給mailxんでいます。

  3. い誤用uuencode:場合に経路を指定のう名の復号化されたファイルではなく、入力ファイル名です。のファイルは二度に割り当てまと同じ名前のファイルの復号化されたとしたものを読み込みます。のmフラグ力をbase64エンコード.それではなくなるわけではありませんの提供を添付のヘッダーのためのmailx.

だからってのコピー mpackには、いと考えている。

なければならないので、なにができるようなこと:

cat <<EOF | ( cat -; uuencode -m /path/to/somefile.csv /path/to/somefile.csv; ) | mailx -s "$subject" "$to" 
place your message from the here block in your example here
EOF

多くの他の可能性を...このこちらの文書 としており、たとえば簡単でしたの私の頭のがあるわけではない一時ファイル。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top