Here is the code for the mailer:
Code: Select all
include 'connect.php'
include 'Mail.php';
include 'Mail/mime.php';
$message = new Mail_mime("\r\n");
$message->setHTMLBody(file_get_contents( 'mail-content.php' ));
//photo field containts image path
$sql = mysql_query("SELECT photo FROM article_info");
while($result = mysql_fetch_array($sql)) {
$message->addHTMLImage("$result");
}
$body = $message->get();
$to = "to@email.com";
$from = "form@email.com";
$subject = "Mail_Mime HTML Test";
$hdrs = array('From' => $from,
'To' => $to,
'Return-Path' => $from,
'Subject' => $subject);
$headers = $message->headers($hdrs);
$smtp = mail-server.email.com;
$sender =& Mail::factory('smtp', $smtp);
$sender->send($to, $headers, $body);