General Linux send alarm mail through the local mailbox or external mailbox server, I am accustomed to use the local mailbox to send mail, install a SendMail installation start, you can send mail functionality, but there are two issues:
1, the sender of the default display host name, and some will be mail service providers when the spam processing, you can also use Mutt to define the sender to solve the problem, to trouble.
2, send a delay, normal words, within a minute can receive, delay large words, a few hours will not be able to receive is also very normal, so the operation and maintenance engineers did not promptly received the alarm e-mail, delay the issue of timely processing.
For these two issues, with external mailbox can be solved, you simply register a domestic mail service provider mailbox, such as 163, you can also use the company mailbox, need to install MAILX tools, MAILX is a small mail sender program, installation is simple, as follows:
Centos:
# yum Install Mailx
# vi/etc/mail.rc #添加邮件信息
set [email protected] smtp=smtp.163.com
set [email protected] smtp-auth-password=123456
Set Smtp-auth=login
Ubuntu:
# sudo apt-get install HEIRLOOM-MAILX
# vi/etc/nail.rc #注意文件名和CentOS不同
set [email protected] smtp=smtp.163.com
set [email protected] smtp-auth-password=123456
Set Smtp-auth=login
To send a message test:
# echo "This is Test mail." |mail- S "test mail" [email protected]
Tips: if it is a QQ mailbox, to set up a mailbox to turn on client connection support, set-up account--open the POP3/SMTP service
This article is from the "Penguin" blog, please be sure to keep this source http://lizhenliang.blog.51cto.com/7876557/1612652
Linux sends mail using an external mailbox