Hi all. I'm new to this forum.
I'm trying to send small bulk personalized emails (data driven) using htmlMimeMail5 without success. Does anyone know if this is possible? When I say small I'm talking about 20 or 30 html emails - small newsletter.
I retrieve a subscribers name, email address and record number from mySQL in an array. I loop through the array like so:
foreach ($addresses as $k=>$v) {
$first_name = $v['first_name'];
$rec_id = $v['rec_id'];
$text_part = file_get_contents('../newsletter/text_part.txt');
$html_part = include('../newsletter/newsletter.php');
$mail = new htmlMimeMail5();
$mail->setFrom('someone@somedomain');
$mail->setSubject($data['subject']);
$mail->setPriority('high');
$mail->setReturnPath('me@mydomain');
$mail->setText($text_part);
$mail->setHTML($html_part);
$sent = $mail->send(array($v['email']));
}
Using include or require for the $html_part variable correctly inserts the variable into the body of the email, but the email that is sent is simply the number 1 in the body of the email (the txt part of the email doesn't contain personalized information and is present in the email when viewing source).
If using file_get_contents the php code in the email isn't recognized, but the email is sent correctly without php interpretation.
BTW, From and ReturnPath have been substituted with fake info for this post.
Thanks in advance