kahodges Posted March 16, 2010 Share Posted March 16, 2010 Can anyone tell me what I'm doing wrong? Thanks in advance. Here's the code: #!/usr/bin/php -q -c /etc/php.ini <? $dbhost = "localhost"; $dbuser = "username"; $dbpass = "password"; $dbname = "database"; mysql_connect($dbhost,$dbuser,$dbpass); @mysql_select_db($dbname) or die("Unable to select database"); return $conn; $query = "SELECT id, vehicle, last_date, due_date FROM inspection WHERE DATE_ADD(CURDATE(),INTERVAL 30 DAY) = due_date;"; $row = mysql_query($query) or die(mysql_error()); $sendto = "Me <me@mydomain.com>"; $sendfrom = "System Backup <admin@mydomain.com>"; $sendsubject = "Maintenance Reminder"; $bodyofemail = $row['vehicle']." ".$row['last_date']." ".$row['due_date']; // 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); ?> Quote Link to comment Share on other sites More sharing options...
StathisG Posted March 16, 2010 Share Posted March 16, 2010 What error do you get? Quote Link to comment Share on other sites More sharing options...
kahodges Posted March 16, 2010 Author Share Posted March 16, 2010 It's not producing an error, but at the same time, it's not sending out the e-mail with the results from the table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.