// If the temporary file exists, attach it $tmp_file = stripslashes($_SESSION['attach_array'][$i]->tmp_file); if (file_exists($tmp_file)) { if ($_SESSION['attach_array'][$i]->disposition == 'attachment' || strpos($mail_body, $_SESSION['attach_array'][$i]->content_id)) { if ($_SESSION['attach_array'][$i]->disposition == 'attachment') { $mail->AddAttachment($tmp_file, imap_qprint($_SESSION['attach_array'][$i]->file_name), 'base64', $_SESSION['attach_array'][$i]->file_mime); } else { $mail->AddEmbeddedImage($tmp_file, $_SESSION['attach_array'][$i]->content_id, imap_qprint($_SESSION['attach_array'][$i]->file_name), 'base64', $_SESSION['attach_array'][$i]->file_mime); } } } } } if ($mailing_group_id > 0) { $feedback = ''; $tp->get_contacts_from_mailing_group($mailing_group_id); while ($tp->next_record()) { $mail->ClearAllRecipients(); //add the body $content = $tp->replace_data_fields($mail_body, $tp->f('id')); if ($html_message) { $mail->Body = $html_mail_head . $content . $html_mail_foot; $h2t =& new html2text($content); $mail->AltBody = $h2t->get_text(); } else { $mail->Body = $content; } $mail->AddAddress($tp->f('email')); if (!$mail->Send()) { $feedback .= $tp->f('email') . ': ' . $mail->ErrorInfo . '<br />'; }