1. System environment.
[Email protected] ~]# cat/etc/redhat-release CentOS release 6.8 (Final) [[email protected] ~]# uname-r2.6.32-642.el6.x86 _64[[email protected] ~]# uname-mx86_64
2. By modifying the configuration file /etc/mail.rc You can use an external SMTP Server to easily implement the Linux email functionality.
[Email protected] ~]# tail/etc/mail.rc# for Linux Andbsd, this should be Set.set Bsdcompat # sendmail configset [email p Rotected]set smtp=smtp.qq.comset [email protected]set smtp-auth-password=xxxxxxxxxxxxxxxset Smtp-auth=login
Note: Most of the external mail services currently use a third-party client, the authorization code is used, the above Smtp-auth-password is the authorization code, not the password of the mail account.
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/8E/83/wKiom1jCmM6wBMOyAApdHEeKbQI528.jpg-wh_500x0-wm_ 3-wmp_4-s_2240667614.jpg "title=" qq20170310201349.jpg "alt=" Wkiom1jcmm6wbmoyaapdheekbqi528.jpg-wh_50 "/>
3. The role of the relevant commands and options.
-s< e-Mail Subject: Specify the subject;-c< address of the message;: Add a message cc, multiple people with a comma separated;-b< address;: Add a message to send people;-a < Accessories;: Add attachments attachthe given file to the message.
(1) method One: Body content redirect input.
[Email protected] ~]# mail-s "title"-a/etc/hosts-c [email protected],[email protected] [email protected] </etc/hosts# Use commas when you have more than one person in the primary send and CC.
(2) method Two: text content through the echo command input .
[Email protected] ~]# echo "Body" |mail-s "title"-a/etc/hosts-c [email protected],[email protected] [email protected]
4. Start the Postfix service
[Email protected] ~]#/etc/init.d/postfix startstarting postfix: [OK][[email Protected] ~]# chkconfig--level 3 postfix on[[email protected] ~]# chkconfig|grep postfixpostfix 0:off 1:o FF 2:off 3:on 4:off 5:off 6:off
So far, email configuration is complete. can be tested normally.
This article is from the "Gray Mouse" blog, please be sure to keep this source http://10049977.blog.51cto.com/10039977/1905296
Quickly configure the Linux messaging service with mail.rc