From 8965db24ccb0793daebd37adc25e769e52492565 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 31 Jan 2011 18:18:28 -0800 Subject: [PATCH] post to email recips (backend) --- mod/item.php | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/mod/item.php b/mod/item.php index cc1886c17b..7125ae1f49 100644 --- a/mod/item.php +++ b/mod/item.php @@ -422,12 +422,39 @@ function item_post(&$a) { logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &"); - proc_run($php_path, "include/notifier.php", $notify_type, "$post_id"); + proc_run($php_path, "include/notifier.php", $notify_type, "$post_id"); $datarray['id'] = $post_id; call_hooks('post_local_end', $datarray); - + + if(strlen($emailcc) && $profile_uid == local_user()) { + $erecips = explode(',', $emailcc); + if(count($erecips)) { + foreach($erecips as $recip) { + $addr = trim($recip); + if(! strlen($addr)) + continue; + $disclaimer = '
' . t('This message was sent to you by ') . $a->user['username'] + . t(', a member of the Friendika social network.') . '
'; + $disclaimer .= t('You may visit them online at') . ' ' + . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '
'; + $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . '
'; + + $subject = '[Friendika]' . ' ' . $a->user['username'] . ' ' . t('posted an update.'); + $headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n"; + $headers .= 'MIME-Version: 1.0' . "\n"; + $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n"; + $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n"; + $link = '' . $a->user['username'] . '

'; + $html = prepare_body($datarray); + $message = '' . $link . $html . $disclaimer . ''; + @mail($addr, $subject, $message, $headers); + } + } + } + + goaway($a->get_baseurl() . "/" . $_POST['return'] ); return; // NOTREACHED