shell命令发送邮件
1.ubantu或centos系统安装sendmail客户端(注意:不是email客户端)--百度即可
2.创建.sh文件,或直接在终端输入如下命令
sendEmail -s "SMTP_server" -xu "username" -xp "password" -f "from_email_address" -t "to_email_address" -u "message_subject" -m "message_body"
SMTP_server:邮件服务器的SMTP服务器地址
username:发件人邮箱
password : 发件人邮箱密码
from_email_address:发件人邮箱
to_email_address: 接受邮件人邮箱
message_subject: 邮件主题
message_body: 邮件内容
若收件人有多个 : -t "reciver1" "reciver2" "reciver3" 中间用空格分割即可
若发送的邮件需要添加附件 : 在最后加上-a "文件路径"
若发送邮件的附件为多个:-a "file1_path" "file2_path" "file3_path" 与多个收件人一样 用空格分割