The original use of Linux SendMail e-mail, and then do a safe time to turn off a sendmail service, resulting in the Mail has been unable to send. Now I'm going to configure the use of external SMTP to send mail, so you don't have to sendmail.
Originally the system comes with MAILX program, because I am REDHAT5 system so can't send mail directly with external SMTP, only upgrade MAILX program can use. So first download the MAILX package.
Mailx-12.4. tar.bz2
Unzip the file and compile the installation:
[[email protected] ~]# tar JXVF mailx-12.4. tar.bz2 Mailx-12.4/MAILX.SPECMAILX-12.4/NAIL.RCMAILX-12.4/V7.LOCAL.CMAILX-12.4/RCV.HMAILX-12.4/MD5.HMAILX-12.4/GLOB.HMAILX-12.4/EXTERN.HMAILX-12.4/DEF.HMAILX-12.4/VERSION.CMAILX-12.4/vars.c ... [[email protected] ~]# CD MAILX-12.4 [[email protected] mailx-12.4]# make/Bin/Sh./Makeconfig CheckingifA Hello World program can be built ... okay Checking for <Alloca.h>... okay Chec King foralloca () ... okay ... [[email protected] mailx-12.4]# Make Install Ucbinstall=/Usr/Bin/Install Test-D/Usr/Local/Bin||Mkdir-P/Usr/Local/bin/Usr/Bin/Install-C MAILX/Usr/Local/Bin/MAILX Strip/Usr/Local/Bin/MAILX T EST-D/Usr/Local/Share/Mans/Man1||Mkdir-P/Usr/Local/Share/Mans/Man1/Usr/Bin/Install-C-M644Mailx.1 /Usr/Local/Share/Mans/Man1/Mailx.1Test-D/etc||Mkdir-P/etc Test
-F/etc/Nail.rc|| \ /Usr/Bin/Install-C-M644Nail.rc/etc/nail.rc
[[email protected] mailx-12.4] # Whereis Mailx /bin//usr/local/bin//usr/share /man/man1p/mailx.1p.gz
In the above I use the Whereis command to view the path of the MAILX command, found the first or the original MAILX command path, so the direct execution of MAILX command when the original MAILX, so can not send mail.
So I put the new MAILX directly replace the old MAILX, here I first delete the original, and then build a soft link.
[[email protected] bin]# Cd/bin
[[email protected] bin]# RM-RF MAILX[[email protected] bin]# ln-S/Usr/Local/Bin/MAILX Mailx[[email protected] bin]# MAILX-V12.4 7/ in/ , [[email protected] bin]# CD [[email protected] ~]# chkconfig--list |grep SendMailSendMail0:off 1:off 2:if 3: on 4:off 5: on 6:off [[email protected] ~]# chkconfig--Level SendMail off
The above steps are the steps to install the software, below we begin to configure to enable sending mail via external SMTP.
[[email protected] ~]$ VI/etc/nail.rc---Add the following at the bottom of the file. Set from=123456789@qq. comSetSmtp=smtp.qq.comSetSmtp-Auth-User=123456789SetSmtp-Auth-Password=YoupasswordSetSmtp-Auth=Login
Then send the message by command:
echo | - - 123456789 @qq
---Here the email address is the same as the email address set above, which is equivalent to self-sent messages.
Linux under Configuration using external SMTP outgoing mail