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