在shell中使用sendmail发送邮件

cat > sendmymail.sh

 

#!/bin/bash
/usr/sbin/sendmail -t <<EOF
From: Mail testing <[email protected]>          
To: [email protected]                                      
Cc: [email protected]                                    
Bcc: [email protected]                                  
Subject: mail testing                                          
----------------------------------                               
This is the mail content ...
---------------------------------
EOF

 

chmod u+x sendmymail.sh

./sendmymail.sh


man sendmail

-t参数的含义

-t     Read message for recipients. To:, Cc:, and Bcc: lines will be
              scanned for recipient addresses. The Bcc: line will be deleted
              before transmission.

相关文章

Centos系统之Shell编程基础知识
从Export理解Shell环境和变量生存期
linux shell数组变量、类型及规则
Centos编程Shell基本工作原理方案
Centos操作系统编程之Shell 问答录
rsync-linux备份脚本