Swaks 有 SMTP 用的瑞士軍刀之稱,小巧好用。
- 安裝:
- 使用範例:
- 郵件附加檔案時,依據檔案性質,需要宣告不同樣式
apt -y install swaks
!/bin/bash
export toList=user01@mail01.xxx.com,user02@mail02.xxx.com
export toList=user03@xxx.com
export ccList=user04@xxx.com
export body_content=mail_content.txt
export attach_dir=/path/swaks_mail
export attach_name_1=filename01.odt
export bcc_file=mail_list.csv
export bccList=$(paste -sd, ${attach_dir}/${bcc_file})
swaks --to $toList \
--cc $ccList \
--bcc $bccList \
--from tpet@xxx.idv.tw \
--server xxx.idv.tw \
--port 587 \
--tls \
--auth LOGIN \
--auth-user tpet \
--auth-password "##@$!@%$" \
--header "Subject: 大會通知信" \
--body @${attach_dir}/${body_content} \
--attach-type application/vnd.oasis.opendocument.text \
--attach @{$attach_dir}/${attach_name_1}
| 副檔名 | MIME Type (--attach-type) |
| odt | application/vnd.oasis.opendocument.text |
| ods | application/vnd.oasis.opendocument.spreadsheet |
| odp | application/vnd.oasis.opendocument.presentation |
application/pdf |
|
| jpg | image/jpeg |
| jpeg | image/jpeg |
| png | image/png |
| gif | image/gif |
| docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
| pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation |
| zip | application/zip |
參考資源
- Swaks官方網站:https://www.jetmore.org/john/code/swaks/
- Swaks程式:https://github.com/jetmore/swaks