post to email recips (backend)

This commit is contained in:
Friendika 2011-01-31 18:18:28 -08:00
parent 082909fe1a
commit 8965db24cc

View file

@ -428,6 +428,33 @@ function item_post(&$a) {
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