"; $sendfrom = "Automated Backup "; $sendsubject = "Daily Mysql Backup"; $bodyofemail = "Here is the daily backup."; // don't need to edit below this section $backupfile = $dbname . date("_d-m-Y") . '.sql.gz'; system("mysqldump -h $dbhost -u $dbuser -p$dbpass $dbname | gzip > $backupfile"); // Mail the file system("echo 'Your database backup '$backupfile' is attached to this email.' | mutt -a $backupfile -s 'forum db backup' -- webmaster@yourdomain.com"); // Delete the file from your server unlink($backupfile); ?>