Linux sends email alerts to extranet via SendMail __linux

Source: Internet
Author: User

Original content, if you want to reprint, please specify the source.

itself because in the installation of the main hot standby high availability MySQL cluster environment, need to involve keepalived mail alarm, mail alarm and need to configure SendMail implementation. So feature this article to record this experience. (This content only involves sendmail part, the entire high available MySQL cluster configuration, the next time to write again.) )


1.rpm-qa | grep MAILX

Center 7 is equipped with a 12.5 version of the MAILX, if there is no need to install again,

Rpm-qa | grep sendmail

Yum-y Install SendMail

2.vim/etc/mail.rc Add the following two lines


Set from=123456@139.com smtp=smtp.139.com


Set smtp-auth-user= your mailbox username smtp-auth-password= your email password smtp-auth=login


Restart SendMail

Service SendMail Restart


echo "Your email content" | Mail-s "Your email subject" Address, for example

echo "Yes, so Good" | Mail-s ' This is Test Mail ' 12345@qq.com

You can also view the contents of a file to send messages. Such as

Cat Hostip.txt | Mail-s ' This is Test Mail ' 12345@qq.com

So, we can write a few automated scripts, output the monitoring results to a txt, and then send the contents of the file to your mailbox

Using the form of a carry attachment, I tried, very slowly, and later found a good way to tell you.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.