mail、sendEmail发送邮件命令
生活随笔
收集整理的這篇文章主要介紹了
mail、sendEmail发送邮件命令
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
申請臨時郵箱地址
- https://blog.csdn.net/u012206617/article/details/104632026
?
Centos
centos自帶mail工具
安裝mail
- yum -y install mailx
配置發送人帳號信息
- vim /etc/mail.rc
- 在最后加兩行代碼
- set from=123456@163.com smtp=smtp.163.com
- set smtp-auth-user=123456@163.com smtp-auth-password=666666 smtp-auth=login
?
Ubuntu
安裝mail
- apt-get install heirloom-mailx
配置發送人賬戶信息
- vim /etc/s-nail.rc 或?/nail.rc(本人是/etc/s-nail.rc)
- 在最后增加兩行代碼
- set from=123456@163.com smtp=smtp.163.com
- set smtp-auth-user=123456@163.com smtp-auth-password=666666 smtp-auth=login
?
mail工具使用
讀取文件內容發送
- mail -s "主題" 郵箱地址?< path/filename
管道形式發送
- echo "郵件內容" | mail -s "主題" 郵箱地址
給多個用戶發送郵件
- mail -s test -c?admin@aispider.com ?root@aispider.com< file
發送附件郵件
- yum?install?sharutils 或 apt-get install?sharutils
- uuencode /home/zhousir/httpd.conf httpd.conf|mail -s mailtest 123@qq.com
- tar czf - /home/zhousir/ | uuencode home.tgz |mail -s mailtest 123@qq.com
- uuencode?test.txt?test?|?mail?-s?"hello,see?the?attachement"?123@qq.com?< mail.txt?
?
sendEmail工具使用
安裝
- apt-get install sendemail?
發送內容
- sendEmail -f 123@163.com -t 123@qq.com -s smtp.163.com -u "主題測試" -o message-content-type=html -o message-charset=utf-8 -o tls=no -xu 123@163.com -xp 123 -m "郵件內容"
發送多人
- sendEmail -f 123@163.com -t 123@qq.com 456@qq.com -s smtp.163.com -u "主題測試" -o message-content-type=html -o message-charset=utf-8 -o tls=no -xu 123@163.com -xp 123 -m "郵件內容"
發送抄送人
- sendEmail -f 123@163.com -t 123@qq.com -cc 456@qq.com -s smtp.163.com -u "主題測試" -o message-content-type=html -o message-charset=utf-8 -o tls=no -xu 123@163.com -xp 123 -m "郵件內容"
發送附件
- sendEmail -f 123@163.com -t 123@qq.com -s smtp.163.com -u "主題測試" -o message-content-type=html -o message-charset=utf-8 -o tls=no -xu 123@163.com -xp 123 -m "郵件內容" -a ./abc.txt
總結
以上是生活随笔為你收集整理的mail、sendEmail发送邮件命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python内置函数——__import
- 下一篇: centos7操作SSH/SSHD服务(