1
1
Fork 0

encode email headers on message deliveries

This commit is contained in:
friendica 2012-02-15 15:28:32 -08:00
parent c965074e53
commit d054426101
3 changed files with 11 additions and 9 deletions

View file

@ -21,6 +21,7 @@ function delivery_run($argv, $argc){
require_once('include/items.php');
require_once('include/bbcode.php');
require_once('include/diaspora.php');
require_once('include/email.php');
load_config('config');
load_config('system');
@ -413,14 +414,14 @@ function delivery_run($argv, $argc){
if($r1 && $r1[0]['reply_to'])
$reply_to = $r1[0]['reply_to'];
$subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ;
$subject = (($it['title']) ? email_header_encode($it['title'],'UTF-8') : t("\x28no subject\x29")) ;
// only expose our real email address to true friends
if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked']))
$headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n";
$headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $local_user[0]['email'] . '>' . "\n";
else
$headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n";
$headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n";
if($reply_to)
$headers .= 'Reply-to: ' . $reply_to . "\n";

View file

@ -35,7 +35,7 @@ function notifier_run($argv, $argc){
require_once("datetime.php");
require_once('include/items.php');
require_once('include/bbcode.php');
require_once('include/email.php');
load_config('config');
load_config('system');
@ -626,14 +626,14 @@ function notifier_run($argv, $argc){
if($r1 && $r1[0]['reply_to'])
$reply_to = $r1[0]['reply_to'];
$subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ;
$subject = (($it['title']) ? email_header_encode($it['title'],'UTF-8') : t("\x28no subject\x29")) ;
// only expose our real email address to true friends
if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked']))
$headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n";
$headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $local_user[0]['email'] . '>' . "\n";
else
$headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n";
$headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n";
if($reply_to)
$headers .= 'Reply-to: ' . $reply_to . "\n";

View file

@ -17,6 +17,7 @@
require_once('include/crypto.php');
require_once('include/enotify.php');
require_once('include/email.php');
function item_post(&$a) {
@ -854,8 +855,8 @@ function item_post(&$a) {
$disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
$disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
$subject = '[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
$headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
$subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']),'UTF-8');
$headers = 'From: ' . email_header_encode($a->user['username'],'UTF-8') . ' <' . $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";