From de131c9e58ac2b14380d145d643bf2bd902ae9dc Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 14 Apr 2011 17:13:13 -0700 Subject: [PATCH] set utf-8 on all emails --- include/items.php | 4 +++- mod/dfrn_confirm.php | 6 +++++- mod/dfrn_notify.php | 12 ++++++++++-- mod/dfrn_request.php | 5 ++++- mod/invite.php | 6 +++++- mod/item.php | 11 +++++++++-- mod/lostpass.php | 11 +++++++++-- mod/register.php | 11 ++++++++--- mod/regmod.php | 5 ++++- 9 files changed, 57 insertions(+), 14 deletions(-) diff --git a/include/items.php b/include/items.php index 82752e1688..733cd80484 100644 --- a/include/items.php +++ b/include/items.php @@ -1415,7 +1415,9 @@ function new_follower($importer,$contact,$datarray,$item) { $res = mail($r[0]['email'], t("You have a new follower at ") . $a->config['sitename'], $email, - 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] ); + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); } } diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 02437ec365..58473146d1 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -651,7 +651,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) { ); $res = mail($r[0]['email'], sprintf( t("Connection accepted at %s") , $a->config['sitename']), - $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] ); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + if(!$res) { // pointless throwing an error here and confusing the person at the other end of the wire. } diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index f6f68d348c..eb9d71fe3f 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -401,7 +401,11 @@ function dfrn_notify_post(&$a) { )); $res = mail($importer['email'], sprintf(t('%s commented on an item at %s'), $from , $a->config['sitename']), - $email_tpl, "From: " . t('Administrator') . '@' . $a->get_hostname() ); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + } } xml_status(0); @@ -487,7 +491,11 @@ function dfrn_notify_post(&$a) { )); $res = mail($importer['email'], sprintf( t("%s commented on an item at %s") , $from ,$a->config['sitename']), - $email_tpl, "From: ".t("Administrator") . "@". $a->get_hostname() ); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + break; } } diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 11b7438a78..3c1c216fef 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -544,7 +544,10 @@ function dfrn_request_content(&$a) { $res = mail($r[0]['email'], t("Introduction received at ") . $a->config['sitename'], $email, - 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] ); + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + // This is a redundant notification - no point throwing errors if it fails. } if($auto_confirm) { diff --git a/mod/invite.php b/mod/invite.php index 84fa978ad1..1c51195957 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -30,7 +30,11 @@ function invite_post(&$a) { } $res = mail($recip, sprintf(t('Please join my network on %s'), $a->config['sitename']), - $message, "From: " . $a->user['email']); + $message, + "From: " . $a->user['email'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + if($res) { $total ++; } diff --git a/mod/item.php b/mod/item.php index 5cefb3be3e..26afec2f44 100644 --- a/mod/item.php +++ b/mod/item.php @@ -472,7 +472,10 @@ function item_post(&$a) { )); $res = mail($user['email'], sprintf( t("%s commented on your item at %s") ,$from,$a->config['sitename']), - $email_tpl,"From: " . t("Administrator") . "@" . $a->get_hostname() ); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); } } else { @@ -495,7 +498,11 @@ function item_post(&$a) { )); $res = mail($user['email'], sprintf( t("%s posted on your profile wall at %s") ,$from, $a->config['sitename']), - $email_tpl,"From: " . t("Administrator") . "@" . $a->get_hostname() ); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + } } diff --git a/mod/lostpass.php b/mod/lostpass.php index c46a57e6a2..8d1cf7629d 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -36,7 +36,11 @@ function lostpass_post(&$a) { )); $res = mail($email, sprintf( t('Password reset requested at %s'),$a->config['sitename']), - $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER[SERVER_NAME]); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + goaway($a->get_baseurl()); } @@ -94,7 +98,10 @@ function lostpass_content(&$a) { '$new_password' => $new_password, '$uid' => $newuid )); - $res = mail($email,"Your password has changed at {$a->config['sitename']}",$email_tpl,"From: Administrator@{$_SERVER[SERVER_NAME]}"); + $res = mail($email,"Your password has changed at {$a->config['sitename']}",$email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); return $o; } diff --git a/mod/register.php b/mod/register.php index 5fe7c0c6dd..83e9e28910 100644 --- a/mod/register.php +++ b/mod/register.php @@ -329,7 +329,10 @@ function register_post(&$a) { '$uid' => $newuid )); $res = mail($email, sprintf(t('Registration details for %s'), $a->config['sitename']), - $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME']); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); if($res) { @@ -366,8 +369,10 @@ function register_post(&$a) { )); $res = mail($a->config['admin_email'], sprintf(t('Registration request at %s'), $a->config['sitename']), - $email_tpl,'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME']); - + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); if($res) { notice( t('Your registration is pending approval by the site owner.') . EOL ) ; goaway($a->get_baseurl()); diff --git a/mod/regmod.php b/mod/regmod.php index 2cbe810bc9..b985ee3644 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -90,7 +90,10 @@ function regmod_content(&$a) { )); $res = mail($user[0]['email'], sprintf(t('Registration details for %s'), $a->config['sitename']), - $email_tpl,'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] ); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); if($res) { notice( t('Account approved.') . EOL ); -- 2.39.5