Use the mail command in RHEL6 to send external emails

Source: Internet
Author: User
In RHEL6, use the mail command to send external mail. First, uninstall the sendmail and postfix: yumremovesendmailyumremovepostfix that come with the system, and then in/etc/mail. add the following lines in rc: setfrom = 123456@126.comsetsmtp = smtp.126.comsetsmtp-auth-user = 123456

Use the mail command in RHEL6 to send external emails

First, uninstall the built-in sendmail and postfix:

Yum remove sendmail

Yum remove postfix

Then add the following lines in/etc/mail. rc:

Set from = 123456@126.com

Set smtp = smtp.126.com

Set smtp-auth-user = 123456

Set smtp-auth-password = xxxxxxx

Set smtp-auth = login

Note: from refers to the sender, smtp-auth-user and smtp-auth-password refer to the user name and password, and smtp-auth is configured as the logon mode.

Next, run the mail command to send an email. Run the following command:

Echo "Content Hello" | mail-s "Test Title"-a testfile.txt 123456@qq.com

(Echo content for the mail body,-s refers to the mail title,-a refers to the attachment, the last 123456@qq.com refers to the recipient.

For more information, see the man manual of mail.

Recommended reading:

Linux Command Line mail method http://www.linuxidc.com/Linux/2013-07/87666.htm

For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10

Related Article

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.