Joke Collection Website - Blessing messages - How to realize email alarm notification and free SMS alarm notification

How to realize email alarm notification and free SMS alarm notification

This can be achieved by the following methods:

1 Use msmtp- 1.4.32.tar.bz2 to download and install mSMTP software.

tar jxvf ms MTP- 1 . 4 . 32 . tar . bz2

cd msmtp- 1.4.32

. /configure-prefix =/usr/local/msmtp

manufacture

Carry out installation

2. Manually create the configuration file and enter the external smtp address.

mkdir–p/usr/local/msmtp/etc

vi /usr/local/msmtp/etc/msmtprc

Add the following

Account default value

Host smtp.sohu.com # Your email server.

Port 25

From which mailbox do you want to send ZABBIX 20 14@sohu.com #?

Authorized login

Tls shutdown

User zabbix20 14 # email username

Password xxxxx-xxx # email password, if you feel unsafe, you can change the file to 600 attribute.

Log file /var/log/mmlog

Save and exit.

3. Simple test

/usr/local/msmtp/bin/msmtp zabbix20 14@sohu.com

Hello, test

ctrl d

See if it was successful.

Then go to Sohu mailbox to see if the letter has been received.

The error report is as follows

[root @ cache-2 msmtp- 1 . 4 . 32]#/usr/local/msmtp/bin/msmtp zabbix20 14@sohu.com

Msmtp: authentication failed (method login)

Msmtp: server message: 535 5.7.0 Invalid result.

Mstp: unable to send mail (account is from/usr/local/mstp/etc/msmtprc by default).

After Google, mutt components need to be installed.

4. Start installing MUTT below. If it's CentOS, just use yum directly.

Yum installs mutt

After the installation is completed, you should manually create a configuration file for him.

vim /etc/Muttrc

Set sendmail = "/usr/local/MSTP/bin/MSTP" # your MSTP command path.

Set use_from=yes.

set real name = " zabbix 20 14 @ Sohu . com "

set editor="vim "

Four simple lines will do.

Ok, let's test it!

Test it: Echo "Test Mail" | Test "Zabbix 20 14@sohu.com.

Ok, after the test, I can receive the email that has been sent, as shown below:

Echo "Test the contents of e-mail 20 14 tom 2" | mutt -s" Test 20 14 Heading 2 "Zabbix 20 14@sohu.com.