Good morning, PHP Builder Community Members.
I am writing an automated personalized mass HTML formatted email PHP script. Basically the purpose of this script is to send emails to our website's membership with a list of matching profiles - up to three at a time (yes, it's a dating website). I have most of the logic built correctly, but the last hurdle I need to cross is the actual sending of the data to the members via email. In the debug view of the script, the set of records look just fine. It builds the table and nested tables just fine with the correct data, but when the emails are received, the following is printed (rather than the HTML formatted message)...
1111111111111111111111111111111111111111111111111111
Basically, this is a template based script.
However, I can't send out the emails correctly, I know it's something wrong with the while loop I have in place in the following set of codes.
$messsage = include ('templates/emails/admin_matches_top.php');
if ($check_match_email_rowcount > 0) {
while ($email_row = mysql_fetch_array($check_match_email_get_result)) {
$my_match_email_id = $email_row[0];
$my_match_email_username = $email_row[1];
$my_match_email_age = $email_row[2];
$my_match_email_type = $email_row[3];
$my_match_email_gender = $email_row[4];
$my_match_email_matchGender = $email_row[5];
$my_match_email_caption = $email_row[6];
$my_match_email_hasphoto = $email_row[7];
$my_match_email_state = $email_row[8];
if ($debug == "on") {
print 'USERID: ';echo $my_userid;print'- Matching Record: ';echo $my_match_email_id;print'<br>';
}
$message .= include ('templates/emails/admin_matches.php');
$update_email_log = "UPDATE match_email_log SET emailed = 1, match_email_sent = NOW() WHERE (userID = $my_userid) AND (matchID = $my_match_email_id)";
if ($update_email_result = mysql_query($update_email_log)) {
if ($debug == "on") {
print 'USERID: ';echo $my_userid;print'- Matching Record Updated: ';echo $my_match_email_id;print'<br>';
}
}
else {
if ($debug == "on") {
print 'USERID: ';echo $my_userid;print'- Matching Record Not Updated: ';echo $my_match_email_id;print'<br>';
}
}
}
$message .= include ('templates/emails/admin_matches_bottom.php');
$email_template = "admin_notify_matches.txt";
$email_subject = ": Your Matches";
$emailer = new Emailer;
if ($emailer->send($email_template,
array(
'subject' => $quick_title . $email_subject,
'sender' => $noreplies_email,
'recipient' => $my_email,
'message' => $message,
'general_header' => $mail_general_header,
'header' => $mail_header,
'footer' => $mail_html_footer
)
)) {
if ($debug == "on") {
print 'USERID : ';echo $my_userid;print'-Matching Records-Sending Email';
print '<hr>';
}
}
else {
print 'USERID : ';echo $my_userid;print'-Matching Records-Could not Send Email. Problem with Email Configurations';
print '<hr>';
}
I know that the $message variable is causing the problem with printing the correct data in the email message, but I can't seem to make it work.
BTW: Here is what is the admin_notify_matches.txt template file (the other template files are fine and do build the correct layout of the recordset)....
[message]
[footer]
Any thoughts on how to get the data to print correctly in the email messages would be greatly appreciated.
Thanks in advance.