Linux send mail with mail command

Source: Internet
Author: User
Tags auth

Recently the company hand-tour of a test area service end old hanging, so the whole script monitoring, hang up to send mail and then automatically restart the service.

Start

First mail A look, the results prompt command not found (company system are custom installed) Hey, pack mail

Forget the mail package name look for we use Yum Search mail to find

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5C/1D/wKiom1UakPvDicVCAAS34vidsxo303.jpg "title=" QQ picture 20150331202035.png "alt=" Wkiom1uakpvdicvcaas34vidsxo303.jpg "/>

Found the next install: Yum install mailx-y

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5C/1E/wKiom1UakiXiYKbAAAEYfsdssRY287.jpg "title=" QQ picture 20150331202526.png "alt=" Wkiom1uakixiykbaaaeyfsdssry287.jpg "/>

Installation is successful!


Next edit the/etc/mail.rc direct file end line plus the following configuration:


Set [email protected] (email address sent)
Set smtp=smtp.xxx.com (SMTP server address of the sending mailbox)
Set smtp-auth-user=xxx (user name)

Set Smtp-auth-password=xxx (password)
Set Smtp-auth=login (login mode)


Then you can call with the Mail command to send mail with the specified mailbox, if there is the need to receive mail, please install the configuration SendMail


Linux uses the Mail command to send e-mail with the following syntax

Mail-s "motif" emailaddress

Example: Send a topic to the email [email protected] Server System error message

echo ' Date +%y_%m_%d_%h:%m ' System Erro | Mail-s "Server" [email protected]









This article is from the "left-handed" blog, make sure to keep this source http://mofeihu.blog.51cto.com/1825994/1627065

Linux send mail with mail command

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.