Mysql automatically backs up and sends emails to a specified mailbox. First, write the Export command using mysqladmin pingmysqldump, and then add the attachments to the email. Use the corresponding com to suspend the emails. For details, refer: http://hi.baidu.com/zd8695/blog/item/ae50b21c4b398a8087d6b6ac.html See the program: @ echo on: mysql directory, the corresponding drive letter, and the drive letter and path of the current bat file set MYSQL_HOME = H: \ wamp \ bin \ mysql \ mysql5.5.16 \ binset MYSQL_DIR = H: set EXECUTE_DIR = C: set EXECUTE_HOME = C: \ Users \ fartpig \ Desktop :: email account password set EMAIL_ACCOUNT = ****** @ 126. comset EMAIL_PASS = ***** www.2cto.com echo start echo save pathecho % cd % set CURRENT_DIR = % cd % echo export SQL % MYSQL_DIR % cd % MYSQL_HOME % echo try mysqlmysqladmin pingmysqldump-u root-proot plane> plane. SQL echo send mail % EXECUTE_DIR % cd % CURRENT_DIR % start % EXECUTE_HOME % \ mail. vbs % EMAIL_ACCOUNT % EMAIL_PASS % MYSQL_HOME %/plane. sqlecho send successpause www.2cto.com corresponding mail. vbs function Send_mail (You_Account, You_Password, Send_Email, Send_Email2, Send_Topic, Send_Body, Send_Attachment) 'Code by NetPatch Changed by ZD8695 'VBS parameter description for sending an email 'you _ Account: your Email account 'you _ Password: Your Email Password 'send _ Email: 'main Email address' Send _ Email2: alternate Email address' Send _ Topic: 'mail topic 'send _ Body: 'mail content' Send _ Attachment: email Attachment You_ID = Split (You_Account, "@",-1, vbTextCompare) 'account and server separation MS_Space =" http://schemas.microsoft.com/cdo/configuration/ "'This is a must, but you can rest assured that the mail Set Email = CreateObject (" CDO. message ") Email. from = You_Account 'must be the same as the account that sent the Email. to = Send_Email 'main Email address If Send_Email2 <> "" Then Email. CC = Send_Email2 'backup Email address End If www.2cto.com Email. subject = Send_Topic 'Email Subject. textbody = Send_Body 'mail content If Send_Attachment <> "" Then Email. addAttachment Send_Attachment 'email attachment End If With Email. configuration. fields. ite M (MS_Space & "sendusing") = 2' mail port. item (MS_Space & "smtpserver") = "smtp. "& You_ID (1) 'smtp server address. item (MS_Space & "smtpserverport") = 25 'smtp server port. item (MS_Space & "smtpauthenticate") = 1 'cdobasec. item (MS_Space & "sendusername") = You_ID (0) 'your email account. item (MS_Space & "sendpassword") = You_Password 'your email password. update End With Email. send 'send mail Set Email = Nothing 'Close component Send_Mail = true' If no error message exists, it means the sending is successful; otherwise, the sending fails If Err Then Err. clear Send_Mail = False End If End Function www.2cto.com If Send_Mail (wscript. arguments (0), wscript. arguments (1), wscript. arguments (0), "", "database plane backup", "view attachment", wscript. arguments (2) = True Then Wscript. echo "sent successfully" Else Wscript. echo "failed to send" End If Note: you can modify the content in the corresponding comment, which includes four parameters and two mailbox-related bat directories and drive letters mail. the vbs directory and drive letter, as well as the address and password of your mailbox at last, can also be modified to send code to other mailboxes. Note that 126 is useful and some other mailboxes are not excluded ..