diff --git a/admin/communication.php b/admin/communication.php
index f529cec..ad5ffce 100644
--- a/admin/communication.php
+++ b/admin/communication.php
@@ -158,15 +158,7 @@ case 'email_save':
/* Allow the fundraising campaigns id to be NULL, it'll never be 0 */
$fcstr = ($fcid == 0) ? 'NULL' : "'$fcid'";
- //first, replace an
with
- $body=str_replace("","
",$bodyhtml);
- //now replace any
with newlines
- $body=eregi_replace('
',chr(13).chr(10),$body);
- //and strip the rest of the tags
- $body=strip_tags($body);
- //and replace
- $body=str_replace(" "," ",$body);
-
+ $body=getTextFromHtml($bodyhtml);
mysql_query("UPDATE emails SET
name='$name',
description='$description',
@@ -583,7 +575,8 @@ case 'dialog_sender':
exit;
case "email_send":
- email_send_new($_POST['to'],$_POST['from'],$_POST['subject'],$_POST['body'],$_POST['bodyhtml']);
+ $body=getTextFromHtml($_POST['bodyhtml']);
+ email_send_new($_POST['to'],$_POST['from'],$_POST['subject'],$body,$_POST['bodyhtml']);
happy_("Email Successfully Sent");
exit;
diff --git a/common.inc.php b/common.inc.php
index 34982ce..c1265b0 100644
--- a/common.inc.php
+++ b/common.inc.php
@@ -956,6 +956,8 @@ function email_send_new($to,$from,$subject,$body,$bodyhtml="") {
$mail->setFrom($from);
$mail->setSubject($subject);
$mail->setText($body);
+ $mail->setTextCharset("utf-8");
+ $mail->setHTMLCharset("utf-8");
//only add the html if we have it
if($bodyhtml) {
@@ -1265,5 +1267,17 @@ function format_duration($seconds, $granularity = 2)
return $output ? $output : '0 sec';
}
+function getTextFromHtml($html) {
+ //first, replace an with
+ $text=str_replace("","
",$html);
+ //now replace any
with newlines
+ $text=eregi_replace('
',chr(13).chr(10),$text);
+ //and strip the rest of the tags
+ $text=strip_tags($text);
+ //and replace
+ $text=str_replace(" "," ",$text);
+ return $text;
+}
+
?>