From 5eebb373e5ac761ba0f2020a85fa6db7544f7229 Mon Sep 17 00:00:00 2001 From: Chris Case Date: Mon, 14 Feb 2011 03:59:54 -0800 Subject: revamped private message templates, added multipart messages with text and html versions, updated de, en, fr and it. Translated the french version of the private message template. --- mod/dfrn_notify.php | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'mod/dfrn_notify.php') diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 49276647a..ffd9020c5 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -181,8 +181,28 @@ function dfrn_notify_post(&$a) { else $body = qp($body);*/ - $msg['body'] = str_replace(array("\\r\\n", "\\r", "\\n"), "
", $msg['body']); - $msg['body'] = html_entity_decode(strip_tags(bbcode($msg['body']))); + //$msg['body'] = str_replace(array("\\r\\n", "\\r", "\\n"), "
", $msg['body']); + //$msg['body'] = html_entity_decode(strip_tags(bbcode($msg['body']))); + $msg['mimeboundary'] =rand(0,9)."-" + .rand(10000000000,9999999999)."-" + .rand(10000000000,9999999999)."=:" + .rand(10000,99999); + + $msg['notificationfromname'] = t('Administrator'); + $msg['notificationfromemail'] = t('noreply') . '@' . $a->get_hostname(); + $msg['headers'] = + "From: {$msg['notificationfromname']} <{$msg['notificationfromemail']}>\n" . + "Reply-To: {$msg['notificationfromemail']}\n" . + "MIME-Version: 1.0\n" . + "Content-Type: multipart/alternative; boundary=\"{$msg['mimeboundary']}\""; + + + $msg['textversion'] + = html_entity_decode(strip_tags(bbcode(stripslashes($msg['body']))),ENT_QUOTES,'UTF-8'); + //$TextMessage = html_entity_decode(strip_tags(bbcode(str_replace(array("\\r\\n", "\\r", "\\n"), "\n",$msg['body'])))); ; + $msg['htmlversion'] + = str_replace(array("\\r\\n", "\\r", "\\n"), "
\n",html_entity_decode($msg['body'])); + $tpl = load_view_file('view/mail_received_eml.tpl'); $email_tpl = replace_macros($tpl, array( '$siteName' => $a->config['sitename'], @@ -194,16 +214,22 @@ function dfrn_notify_post(&$a) { '$senderName' => $importer['senderName'], '$from' => $msg['from-name'], '$title' => stripslashes($msg['title']), - '$body' => $msg['body'], + '$textversion' => $msg['textversion'], + '$htmlversion' => $msg['htmlversion'], + '$mimeboundary' => $msg['mimeboundary'], '$hostname' => $a->get_hostname() )); + logger("message headers: " . $msg['headers']); + logger("message body: " . $mail_tpl); + + $res = mail($importer['email'], t('New mail received at ') . $a->config['sitename'], - $email_tpl, - 'From: ' . t('Administrator') . '@' . $a->get_hostname() . "\r\n" + $email_tpl, $msg['headers'] + /* 'From: ' . t('Administrator') . '@' . $a->get_hostname() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" - . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" - . 'Content-transfer-encoding: 7-bit' . "\r\n" + . 'Content-type: text/html; charset=utf-8' . "\r\n" + . 'Content-transfer-encoding: quoted-printable' . "\r\n" */ ); } xml_status(0); -- cgit v1.2.3