結論
-
--attachment @filename
のようにファイル名の前に@
を加える。 -
以前のバージョンでは
@
は必要ないですが、v20240103.0 から@
が必要になりました。
経緯
ファイルを添付して送る際に@
を抜いた状態で送信したところ、ファイル名のみBase64にて暗号化される現象に悩まされました。
ファイル添付メール送信テスト(失敗例)
$ swaks -t you@example.com --from me@example.com -au me@example.com --attach swakstest.txt --server 192.0.2.1 --body body.txt --header "Subject: Mailtest"
(省略)
-> ------=_MIME_BOUNDARY_000_168599
-> Content-Type: application/octet-stream
-> Content-Disposition: attachment
-> Content-Transfer-Encoding: BASE64
->
-> c3dha3N0ZXN0LnR4dA== # ファイル名「swakstest.txt」がBase64に暗号化
->
-> ------=_MIME_BOUNDARY_000_168599--
ファイル添付メール送信テスト(成功例)
$ swaks -t you@example.com --from me@example.com -au me@example.com --attach @swakstest.txt --server 192.0.2.1 --body body.txt --header "Subject: Mailtest"
(省略)
-> ------=_MIME_BOUNDARY_000_175923
-> Content-Type: application/octet-stream; name="swakstest.txt"
-> Content-Description: swakstest.txt
-> Content-Disposition: attachment; filename="swakstest.txt"
-> Content-Transfer-Encoding: BASE64
->
-> 44GT44KM44Gvc3dha3Pjga7jg4bjgrnjg4jjgafjgZnjgIIK # ファイルの中身がBase64に暗号化されました!
->
-> ------=_MIME_BOUNDARY_000_175923--
参考
- Swaks Versions: https://jetmore.org/john/code/swaks/versions.html