]> git.mxchange.org Git - friendica.git/commitdiff
post to email recips (backend)
authorFriendika <info@friendika.com>
Tue, 1 Feb 2011 02:18:28 +0000 (18:18 -0800)
committerFriendika <info@friendika.com>
Tue, 1 Feb 2011 02:18:28 +0000 (18:18 -0800)
mod/item.php

index cc1886c17b64f2dfd193bfec3a6d5a2308b5e816..7125ae1f49c8c61e7cbb762d2068be22a4c1dc1c 100644 (file)
@@ -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 = '<hr />' . t('This message was sent to you by ') . $a->user['username'] 
+                                       . t(', a member of the Friendika social network.') . '<br />';
+                               $disclaimer .= t('You may visit them online at') . ' ' 
+                                       . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '<br />';
+                               $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . '<br />'; 
+
+                               $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 href="' . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
+                               $html    = prepare_body($datarray);
+                               $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
+                               @mail($addr, $subject, $message, $headers);
+                       }
+               }
+       }
+
+
 
        goaway($a->get_baseurl() . "/" . $_POST['return'] );
        return; // NOTREACHED