Using the mail to send mail under Linux

Mail is often one of the alarm means Linux under surveillance. mail command in the Linux can easily and quickly complete sending mail. Below an example CentOS

1, the installation

2, disposed 
vi /etc/mail.rc plus end of the file as follows (Note: Because relatively simple set 163, the mailbox 163 as an example, QQ-mail, etc., as other mailboxes safety considerations, the need to set up more , the specific can do, this is not the focus of .QQ mail is also possible)

set [email protected]
set smtp=smtp.163.com
set [email protected]
set smtp-auth-password=邮箱密码
set smtp-auth=login


3, send mail test

# echo "Content" | mail -s "Title" [email protected],[email protected]

4. Other

      mail command can be used to view more specific use

    mail --h 

      For example:

     a, no message body  

          # mail -s "Title"  [email protected]

      b, there is the message body

          #   mail -s "Tile"  abc@qq.com </root/zabbix.txt 

         /Root/zabbix.txt or CAT | mail -s  "Tile "   abc @ qq.com

         或者 echo “”Content“  |   mail -s "Tile"  abc@qq.com 

    c, e-mail with attachments

       mail -s "Tile"  abc@qq.com  -a  /root/zabbix.txt  

 

      

 

1, the installation

2, disposed 
vi /etc/mail.rc plus end of the file as follows (Note: Because relatively simple set 163, the mailbox 163 as an example, QQ-mail, etc., as other mailboxes safety considerations, the need to set up more , the specific can do, this is not the focus of .QQ mail is also possible)

set [email protected]
set smtp=smtp.163.com
set [email protected]
set smtp-auth-password=邮箱密码
set smtp-auth=login


3, send mail test

# echo "Content" | mail -s "Title" [email protected],[email protected]

4. Other

      mail command can be used to view more specific use

    mail --h 

      For example:

     a, no message body  

          # mail -s "Title"  [email protected]

      b, there is the message body

          #   mail -s "Tile"  abc@qq.com </root/zabbix.txt 

         /Root/zabbix.txt or CAT | mail -s  "Tile "   abc @ qq.com

         或者 echo “”Content“  |   mail -s "Tile"  abc@qq.com 

    c, e-mail with attachments

       mail -s "Tile"  abc@qq.com  -a  /root/zabbix.txt  

 

      

 

Guess you like

Origin www.cnblogs.com/eos666/p/11828645.html