On CentOS 6.3, you can use an external SMTP server to send mail by installing MAILX.
Yum Install Mailx-y
After the installation, edit the configuration file.
Mailx-v
12.4 7/29/08 <<MAILX Version number
RPM-QC MAILX
/etc/mail.rc << Online Many tutorials have written the configuration file name is Nail.rc, is it the old version of the reason?
Vi/etc/mail.rc
At the end of the file, add the following. (about this configuration file, man is no data, I also refer to the online tutorial, if you want to study, estimated to check Mailx's official website) pro-Test available
Set from= your e-mail address
Set smtp= your SMTP server address, which can be a domain name or IP
Set smtp-auth-user= user name for authentication
Set smtp-auth-password= password (clear text)
Set Smtp-auth=login << here as input
Here to illustrate, generally from and Smtp-auth-user is the same, but there are different times, depending on the circumstances, if not sure, try to stay consistent.
Send mail, Iostat.result is I used to do Test text file, Mailx have a lot of parameters available, such as-D is to test not really send
Cat Iostat.result | Mailx-v-a Iostat.result-s "iostat" [email protected]
This command down, you can send me a copy titled Iostat, Attachment for Iostat.result, the message body is iostat.result content of the message.
This article is from "Dad Coosh" blog, please be sure to keep this source http://coosh.blog.51cto.com/6334375/1733373
Linux Learning notes: sending mail using external SMTP