Get In Touch
113 Cherry St #92768,
Seattle, WA 98104-2205
[email protected]
Back

How to e-mail to yourself an automatic backup of your MySQL database


// Put in your variable values here.
$dbhost = "yourhost"; // usually localhost
$dbuser = "yourusername";
$dbpass = "yourpassword";
$dbname = "yourdb";
$sendto = "You ";
$sendfrom = "Automated Backup ";
$sendsubject = "Daily Mysql Backup";
$bodyofemail = "Here is the daily backup.";

// don't need to edit below this section 
$backupfile = $dbname . date("Y-m-d") . '.sql';
system("mysqldump -h $dbhost -u $dbuser -p$dbpass $dbname > $backupfile");
 
// Mail the file
//the includes here are for your PEAR extensions. Confirm PEAR is installed in your PHP.
 
    include('Mail.php');
    include('Mail/mime.php');
 
	$message = new Mail_mime();
	$text = "$bodyofemail";
	$message->setTXTBody($text);
	$message->AddAttachment($backupfile);
    	$body = $message->get();
        $extraheaders = array("From"=>"$sendfrom", "Subject"=>"$sendsubject");
        $headers = $message->headers($extraheaders);
    $mail = Mail::factory("mail");
    $mail->send("$sendto", $headers, $body);
 
// Delete the file from your server
unlink($backupfile);

3 comments

  • The very best replica Oakleys that you can find would be the most popular and trendy. The authentic Oakleys have distinctive 袔庐O袔袊 for Oakley discovered on the arms with the sunglasses. There are lots of manufacturers of these replica glasses and also you can without difficulty examine their rates that means you possibly can spot one particular that’s not just of decent superior quality, but in addition good for the spending budget. Still, you’ll want to realize that not all suppliers or suppliers of these replica glasses during the industry have superior replica Oakleys to present. For that reason you’ll want to take the time in learning concerning the products these glasses are produced from and if they can offer you with UV protection and durability the genuine Oakleys can provide you with.

Leave a Reply

Your email address will not be published. Required fields are marked *

This website stores yummy cookies on your computer. Cookie Policy