/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<? // Create the mysql backup file // edit this section $dbhost = "yourhost"; // usually localhost $dbuser = "yourusername"; $dbpass = "yourpassword"; $dbname = "yourdb"; $sendsubject = "Daily Mysql Backup"; $bodyofemail = "Here is the daily backup."; // don't need to edit below this section // Mail the file include('Mail.php'); include('Mail/mime.php'); $message = new Mail_mime(); $text = "$bodyofemail"; $message->setTXTBody($text); $message->AddAttachment($backupfile); $body = $message->get(); $headers = $message->headers($extraheaders); $mail->send("$sendto", $headers, $body); // Delete the file from your server ?>
URL: http://www.theblog.ca/mysql-email-backup
Comments
