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 <[email protected]>"; $sendfrom = "System Backup <[email protected]>"; $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); ?> Link to comment https://forums.phpfreaks.com/topic/195483-php-retrieving-data-from-mysql-table-and-sending-it-in-e-mail-form/ Share on other sites More sharing options...
StathisG Posted March 16, 2010 Share Posted March 16, 2010 What error do you get? Link to comment https://forums.phpfreaks.com/topic/195483-php-retrieving-data-from-mysql-table-and-sending-it-in-e-mail-form/#findComment-1027249 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. Link to comment https://forums.phpfreaks.com/topic/195483-php-retrieving-data-from-mysql-table-and-sending-it-in-e-mail-form/#findComment-1027294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.