- // assemble the final multipart message body with the text and html types included
- $textbody = chunk_split(base64_encode($email_text_body_tpl));
- $htmlbody = chunk_split(base64_encode($email_html_body_tpl));
- $multipart_message_body =
- "--" . $msg['mimeboundary'] . "\n" . // plain text section
- "Content-Type: text/plain; charset=UTF-8\n" .
- "Content-Transfer-Encoding: base64\n\n" .
- $textbody . "\n" .
- "--" . $msg['mimeboundary'] . "\n" . // text/html section
- "Content-Type: text/html; charset=UTF-8\n" .
- "Content-Transfer-Encoding: base64\n\n" .
- $htmlbody . "\n" .
- "--" . $msg['mimeboundary'] . "--\n"; // message ending
-
-
- // send the message
- $res = mail(
- $importer['email'], // send to address
- t('New mail received at ') . $a->config['sitename'], // subject
- $multipart_message_body, // message body
- $msg['headers'] // message headers
+ // use the EmailNotification library to send the message
+ require_once("include/EmailNotification.php");
+ EmailNotification::sendTextHtmlEmail(
+ $msg['notificationfromname'],
+ $msg['notificationfromemail'],
+ $msg['notificationfromemail'],
+ $importer['email'],
+ t('New mail received at ') . $a->config['sitename'],
+ $email_html_body_tpl,
+ $email_text_body_tpl