tracking mail notifications

This commit is contained in:
Mike Macgirvin 2010-08-10 22:14:17 -07:00
parent 9662c44a17
commit eb6b2677cb
3 changed files with 10 additions and 12 deletions

View File

@ -97,6 +97,7 @@ class App {
function set_baseurl($url) { function set_baseurl($url) {
$this->baseurl = $url; $this->baseurl = $url;
$this->hostname = basename($url);
} }
function get_hostname() { function get_hostname() {

View File

@ -68,6 +68,7 @@ function dfrn_notify_post(&$a) {
$msg['parent-uri'] = notags(unxmlify($base['in-reply-to'][0]['data'])); $msg['parent-uri'] = notags(unxmlify($base['in-reply-to'][0]['data']));
$msg['created'] = datetime_convert(notags(unxmlify('UTC','UTC',$base['sentdate'][0]['data']))); $msg['created'] = datetime_convert(notags(unxmlify('UTC','UTC',$base['sentdate'][0]['data'])));
$r = q("INSERT INTO `mail` (`" . implode("`, `", array_keys($msg)) $r = q("INSERT INTO `mail` (`" . implode("`, `", array_keys($msg))
. "`) VALUES ('" . implode("', '", array_values($msg)) . "')" ); . "`) VALUES ('" . implode("', '", array_values($msg)) . "')" );
@ -76,7 +77,7 @@ function dfrn_notify_post(&$a) {
intval($importer['uid']) intval($importer['uid'])
); );
require_once('bbcode.php'); require_once('bbcode.php');
if((count($r)) && ($r[0]['notify_flags'] & NOTIFY_MAIL)) { if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_MAIL)) {
$tpl = file_get_contents('view/mail_received_eml.tpl'); $tpl = file_get_contents('view/mail_received_eml.tpl');
$email_tpl = replace_macros($tpl, array( $email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
@ -90,14 +91,10 @@ function dfrn_notify_post(&$a) {
)); ));
$res = mail($r[0]['email'], t("New mail received at ") . $a->config['sitename'], $res = mail($r[0]['email'], t("New mail received at ") . $a->config['sitename'],
$email_tpl,t("From: Administrator@") . $_SERVER[SERVER_NAME] ); $email_tpl,t("From: Administrator@") . $a->get_hostname() );
if(!$res) {
notice( t("Email notification failed.") . EOL );
} }
}
xml_status(0); xml_status(0);
return; return; // NOTREACHED
} }
foreach($feed->get_items() as $item) { foreach($feed->get_items() as $item) {

View File

@ -2,11 +2,11 @@
Dear $username, Dear $username,
You've received a new private message at $sitename from '$from'. You've received a new private message at $sitename from '$from'.
-----
$title $title
-----
$body $body
-----
Please login at $siteurl to read and reply to your private messages. Please login at $siteurl to read and reply to your private messages.
Thank you, Thank you,