I'm trying to get a Cron script to work
I have removed any sensitive information.
I believe that the problem concerns:
include('Mail.php');
include('Mail/mime.php');
What am I doing wrong with the following script?
http://www.phpfreaks.com/tutorials/130/6.php
// http://www.vbulletin.com/forum/archive/index.php/t-113143.html
// http://hudzilla.org
// Create the mysql backup file
// edit this section
$dbhost = "localhost"; // usually localhost
$dbuser = "usern";
$dbpass = "password";
$dbname = "dbname";
$sendto = "Webmaster ";
$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
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);
?>
Thank you
Jim MacLeod
You have many domains in your account, but the one that was most recently used is the one I am assuming you are working with. If you are running the script from the root folder for the domain, the Mail folder is in that, followed by mail.php and mime.php.
To use the relative paths in the code, it would look like this:
include('Mail/mail.php');
include('Mail/mime.php');
This means it will start from where the file is, look for the Mail folder and then look for the mail.php and mime.php files.
Kindest Regards,
Scott M