It suddenly occurred to me today that it would be nice if the server could send a daily MySQL backup to my mail. I also do not need to go to the server every day to download backup files, and this machine can also appear hard disk mechanical failure, if you can send to my mailbox, that is the mail server to ensure that my attachment security! That is not a very cool rhythm, say dry! Ma ni, how to send mail ah. All right, find a mother.
Step1: Configuring Information for SMTP
The code is as follows |
Copy Code |
[Root@smala ~]# vi/etc/mail.rc |
At the end of the file and add two lines (here I use the Tencent SMTP server for testing, you can replace the SMTP information you need)
The code is as follows |
Copy Code |
Set from=534917582@qq.com smtp=smtp.qq.com Set smtp-auth-user=534917582 smtp-auth-password= your password smtp-auth=login |
OK, configuration complete, we are now starting to send mail
The code is as follows |
Copy Code |
[Root@smala mysqlbak]# echo "Mail Content" | Mail-s "Mail title" penggangma@126.com |
Can you send an email (-_-!), a good deal for sending backup files, Nani?
The code is as follows |
Copy Code |
[Root@smala mysqlbak]# echo "mysql bak content" | Mail-s "2014-6-3 mysql bakfile www.111cn.net"-a/web/backup/mysqlbak/bbs.2014-05-29-17-05-12.sql penggangma@126.com |
Plus the-a parameter specifies the absolute path of the attachment, go.
Recently a lot of websites to pick my page is not to bring the source, O (???) O Alas, lazy to write I understand, but the diligent delete I add the website connection you diligently deleted, I just want to say to you: hehe ~ ~ ~