updated private message code to use the new EmailNotification library
This commit is contained in:
parent
dba7874131
commit
9260bb4ce1
1 changed files with 11 additions and 37 deletions
|
@ -173,22 +173,10 @@ function dfrn_notify_post(&$a) {
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
if($importer['notify-flags'] & NOTIFY_MAIL) {
|
if($importer['notify-flags'] & NOTIFY_MAIL) {
|
||||||
|
|
||||||
// generate a mime boundary
|
|
||||||
$msg['mimeboundary'] =rand(0,9)."-"
|
|
||||||
.rand(10000000000,9999999999)."-"
|
|
||||||
.rand(10000000000,9999999999)."=:"
|
|
||||||
.rand(10000,99999);
|
|
||||||
|
|
||||||
// name of the automated email sender
|
// name of the automated email sender
|
||||||
$msg['notificationfromname'] = t('Administrator');
|
$msg['notificationfromname'] = t('Administrator');
|
||||||
// noreply address to send from
|
// noreply address to send from
|
||||||
$msg['notificationfromemail'] = t('noreply') . '@' . $a->get_hostname();
|
$msg['notificationfromemail'] = t('noreply') . '@' . $a->get_hostname();
|
||||||
// message headers
|
|
||||||
$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']}\"";
|
|
||||||
|
|
||||||
// text version
|
// text version
|
||||||
// process the message body to display properly in text mode
|
// process the message body to display properly in text mode
|
||||||
|
@ -239,30 +227,16 @@ function dfrn_notify_post(&$a) {
|
||||||
'$hostname' => $a->get_hostname() // name of this host
|
'$hostname' => $a->get_hostname() // name of this host
|
||||||
));
|
));
|
||||||
|
|
||||||
// assemble the final multipart message body with the text and html types included
|
// use the EmailNotification library to send the message
|
||||||
$textbody = chunk_split(base64_encode($email_text_body_tpl));
|
require_once("include/EmailNotification.php");
|
||||||
$htmlbody = chunk_split(base64_encode($email_html_body_tpl));
|
EmailNotification::sendTextHtmlEmail(
|
||||||
$multipart_message_body =
|
$msg['notificationfromname'],
|
||||||
"--" . $msg['mimeboundary'] . "\n" . // plain text section
|
$msg['notificationfromemail'],
|
||||||
"Content-Type: text/plain; charset=UTF-8\n" .
|
$msg['notificationfromemail'],
|
||||||
"Content-Transfer-Encoding: base64\n\n" .
|
$importer['email'],
|
||||||
$textbody . "\n" .
|
t('New mail received at ') . $a->config['sitename'],
|
||||||
"--" . $msg['mimeboundary'] . "\n" . // text/html section
|
$email_html_body_tpl,
|
||||||
"Content-Type: text/html; charset=UTF-8\n" .
|
$email_text_body_tpl
|
||||||
"Content-Transfer-Encoding: base64\n\n" .
|
|
||||||
$htmlbody . "\n" .
|
|
||||||
"--" . $msg['mimeboundary'] . "--\n"; // message ending
|
|
||||||
|
|
||||||
logger("message headers: " . $msg['headers']);
|
|
||||||
logger("message body: " . $mail_tpl);
|
|
||||||
|
|
||||||
|
|
||||||
// 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
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
xml_status(0);
|
xml_status(0);
|
||||||
|
|
Loading…
Reference in a new issue