- logger("message headers: " . $msg['headers']);
- logger("message body: " . $mail_tpl);
-
-
- $res = mail($importer['email'], t('New mail received at ') . $a->config['sitename'],
- $email_tpl, $msg['headers']
- /* 'From: ' . t('Administrator') . '@' . $a->get_hostname() . "\r\n"
- . 'MIME-Version: 1.0' . "\r\n"
- . 'Content-type: text/html; charset=utf-8' . "\r\n"
- . 'Content-transfer-encoding: quoted-printable' . "\r\n" */
+ // load the template for private message notifications
+ $tpl = load_view_file('view/mail_received_text_body_eml.tpl');
+ $email_text_body_tpl = replace_macros($tpl,array(
+ '$siteName' => $a->config['sitename'], // name of this site
+ '$siteurl' => $a->get_baseurl(), // descriptive url of this site
+ '$thumb' => $importer['thumb'], // thumbnail url for sender icon
+ '$email' => $importer['email'], // email address to send to
+ '$url' => $importer['url'], // full url for the site
+ '$from' => $msg['from-name'], // name of the person sending the message
+ '$title' => stripslashes($msg['title']), // subject of the message
+ '$textversion' => $msg['textversion'], // text version of the message
+ '$mimeboundary' => $msg['mimeboundary'], // mime message divider
+ '$hostname' => $a->get_hostname() // name of this host
+ ));
+
+ // 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