Borrow smtp.qq.com e-mail

Source: Internet
Author: User

As for the configuration of Sentmail and postfix how troublesome the students here is not much nonsense ... Anyway is configured for n hours, eventually get dizzy also didn't fix ...

Here are some ways you can get rid of these two tools completely ... Of course, if you want to be a mail server, it makes conceivable ... If you just want the server to send an e-mail or something, you can use the following.

The usual practice is to turn off the SendMail service or Postfix service on this machine,

#执行下面的命令, you are the hero of the seat #sendmialservice sendmail stopchkconfig sendmail off#postfixservice postfix stopchkconfig postfix Off

#再狠一点就直接卸载吧:

Yum Remove SendMail Yum remove Postfix
 then modify the/etc/mail.rc, add a similar n line, specify the external SMTP server address, account password and so on.
vi /etc/mail.rc  setfrom =123456@qq. Comset smtp=smtp.qq.com  Set SMTP-auth-user=123456set SMTP-auth-password=sbsbsbsbset smtp-auth=Login 

then send the message by command, echo Hello Word | mail-s "title" [Email protected]

However, it is no problem to find that running in RHEL6, under RHEL5, the Mail command always calls the local SendMail service to send the message. In the end RHEL6 and RHEL5 under the mail and mailx have what relationship? Under the RHEL6,Mail link to mailx command, MAILX version is 12.4
# rpm-qa|grepMAILX Mailx-12.4-6. el6.x86_64 # ll/bin/mail*lrwxrwxrwx.1Root root5July A  ./bin/mailMAILX-rwxr-xr-x.1Root root390424February -  ./bin/mailx # Mail-V12.4 7/ in/ ,  

RHEL5, they found something different,Mailx links to the Mail command, MAILX version 8.1
 # rpm-qa| grep   Mailx mailx -1 -44.2 . 2   # ll /bin/mail*-rwxr-xr-x 1  root Mail Span style= "color: #800080;" >84856  June 6  2007 /bin/mail lrwxrwxrwx  1  root root 4  APR Span style= "color: #800080;" >12  18 : 03 /bin/mailx-> mail # mail -V here will be an error, no-v this parameter 

That is, under Rhel6\5, running Mail and MAILX, is actually a command, and the mail version is different, resulting in RHEL5 under the Mail command cannot invoke the external SMTP server.

Install the new version of MAILX to resolve this issue. :http://www.filewatcher.com/m/mailx-12.4.tar.bz2.271482.0.0.html

After download,# tar jxvf mailx-12.4.tar.bz2 9# CD mailx-12.4# make# make install Ucbinstall=/usr/bin/install

View MAILX program default installation location, and version

# Whereis Mailx mailx:/usr/local/bin/mailx/usr/share/man/man1p/mailx.1p.gz # mailx-v 12.4 7/29/08 after installation MAILX using/etc/na Il.rc configuration, not/etc/mail.rc this needs attention. VI edit, press g, then add the following n lines at the end of the line
vi /etc/nail.rc  (Do you see the bright spot?) ) Setfrom =123456@qq. Comset smtp=smtp.qq.com set SMTP-auth-user=123456  5  Set smtp-auth-password=sbsbsbsbset smtp-auth=login

Then send the message by command.

echo Hello Word | Mailx-v-S "title" [email protected] Server Status Monitoring script email issue inquiry: Server state File Generation server language: [[email protected]_174_31/data/home/report]# EC Ho $LANGen _us Server state processing Server language: [[email protected] forilen]# echo $LANGen _us. UTF-8 message sending Core script:
Check () {Srvid=$1Srvname=$2Grpname=$3Root=`CatServer_$srvid.txt |awk '{print $9}'|awk-f%'{print $}'' Data=`CatServer_$srvid.txt |awk '{print $}'|awk-f%'{print $}'' MySQL-uroot-p1234-e"load Data infile ' $path/server_$srvid.txt ' into table serverdb.server_status;"&>/dev/NULL    if[$root-gt $deadline-o $data-GT $deadline] Then        Echo>>mail.log#CatServer_$srvid.txt >>mail.log#CatServer_$srvid.txt >>Mail.txtEcho-E"$grpname">./Srv_head.txtEcho-E"$srvname">>./Srv_head.txtCatSrv_head.txt Server_$srvid.txt >>Mail.logCatServer_$srvid.txt |/bin/mail-s"Diskwarming_$ts_$grpname_$srvname"[email protected] #CatServer_$srvid.txt >>./Srv_head.txt #Echo "1">>./srv_head.txt#CatSrv_head.txt | /bin/mail-s"Diskwarming_$ts"[email protected]fi    RMserver_$srvid.txt*-F}
Due to the different encoding format of the two servers, the encoding exception occurred when the file was appended later, and Mail could not parse, causing the exception attachment (Tcmime.744.744.888.bin) to be sent. Grpname The stored database code:
Mysql> Show variables like'%char%';+--------------------------+-----------------------------------+| variable_name | Value |+--------------------------+-----------------------------------+| character_set_client | Latin1 | | character_set_connection | Latin1 | | Character_set_database | Latin1 | | Character_set_filesystem | binary | | Character_set_results | Latin1 | | Character_set_server | Latin1 | | Character_set_system | UTF8 | | Character_sets_dir | /data/mysql/share/mysql/charsets/|+--------------------------+-----------------------------------+ | Ser_group |CREATE TABLE ' ser_group ' (' group_id ' tinyint (4) not NULL auto_increment, ' group_name ' varchar ( -) Default'0', ' group_status ' tinyint (4) not NULL, ' appid ' varchar ( -) Default NULL, PRIMARY KEY (' group_id ') ENGINE=innodb auto_increment=101DEFAULT Charset=utf8 | 
Solution: Precede the shell script with:export lang= "en_US. UTF-8 "

Borrow smtp.qq.com to send mail

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.