
dan - 2013-10-24 22:47:57 -
In reply to message 3 from Manuel Lemos
<?php
require('post/email_message.php');
require('post/sendmail_message.php');
$message=new sendmail_message_class;
$message->SetBulkMail(true);
$message->SetEncodedHeader('Subject', 'Some subject');
/*
* Define the recipients list
*/
$to=array(
array(
"address"=>"dan@something.com",
"name"=>"Peter Gabriel"
),
array(
"address"=>"dan@somthing.info",
"name"=>"Paul Simon"
),
array(
"address"=>"dan@something.org",
"name"=>"Mary Chain"
)
);
/**/
/*
* Create a place holder text message body part
*/
$text = 'Hello, some text message';
$message->CreateQuotedPrintableTextPart($text, '',$text_part);
/*
* Create a place holder HTML message body part
*/
$html = 'Hello, some HTML message';
$message->CreateQuotedPrintableHtmlPart($html, '', $html_part);
/*
* Assemble the text and HTML parts as alternatives
*/
$alternative_parts = array($text_part, $html);
$message->AddAlternativeMultipart($alternative_parts);
/*
* Cache the message for all recipients
*/
$message->cache_body = true;
/*
* Iterate for each recipient.
*/
foreach($to as $recipient)
{
/* Personalize the recipient address. */
$message->SetEncodedEmailHeader('To',
$recipient['address'], $recipient['name']);
/* Send the message checking for eventually acumulated errors */
$error=$message->Send();
if(strlen($error))
echo $error . '<br>';
}
?>