utf-8
I have changed the smtp char set to utf-8 and in my server php.ini changed my default_charset to utf-8 but when i send email with ' or " or / in the mail body, I see \' or \" or /\ or even ’
I have also changed the apache default char
The email body comes from a text area that uses JavaScript for a rich text editor; don't know if that affects the setting for utf-8?
Including code from pages
<?php
$MailAttachments = "";
$MailBCC = "";
$MailCC = "";
$MailTo = "";
$MailBodyFormat = "";
$MailBody = "";
$MailImportance = "";
$MailFrom = "".((isset($_POST["from1"]))?$_POST["from1"]:"") ."";
$MailSubject = "".((isset($_POST["subject1"]))?$_POST["subject1"]:"") ."";
$_SERVER["QUERY_STRING"] = "";
//Global Variables
$WA_MailObject = WAUE_Definition("","","","","","UTF-8");
if ($RecipientEmail) {
$WA_MailObject = WAUE_AddRecipient($WA_MailObject,$RecipientEmail);
}
else {
//To Entries
}
//Additional Headers
//Attachment Entries
$WA_MailObject = WAUE_AddAttachment($WA_MailObject,"".(AttachFromUpload("attach")) ."");
//BCC Entries
//CC Entries
//Body Format
$WA_MailObject = WAUE_BodyFormat($WA_MailObject,0);
//Set Importance
$WA_MailObject = WAUE_SetImportance($WA_MailObject,"3");
//Start Mail Body
$MailBody = $MailBody . "<html><head></head><body><br />\r\n";
$MailBody = $MailBody . ((isset($_POST["message1"]))?$_POST["message1"]:"");
$MailBody = $MailBody . "</body></html>";
//End Mail Body
$WA_MailObject = WAUE_SendMail($WA_MailObject,$MailAttachments,$MailBCC,$MailCC,$MailTo,$MailImportance,$MailFrom,$MailSubject,$MailBody,"waue_emailgroup_1");
if (isset($GLOBALS["waue_emailgroup_1_Status"])) {
$MailLogBindings = new WAUE_Log_Bindings();
//Start Log Bindings
//End Log Bindings
$MailLogBindings->SuccessOrFailure->MailRef = "waue_emailgroup_1";
$MailLogBindings->Success->MailRef = "waue_emailgroup_1";
$MailLogBindings->Failure->MailRef = "waue_emailgroup_1";
$MailLogBindings->processLog(($GLOBALS["waue_emailgroup_1_Status"] == "Failure"));
}
$WA_MailObject = null;
?>
code from page that generates the email
<?php require_once('Connections/connmpmga1.php'); ?>
<?php require_once( "webassist/security_assist/helper_php.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to admin")){
WA_Auth_RestrictAccess("admin_login.php");
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_connmpmga1, $connmpmga1);
$query_rs_members = "SELECT members.EmailAddress FROM members";
$rs_members = mysql_query($query_rs_members, $connmpmga1) or die(mysql_error());
$row_rs_members = mysql_fetch_assoc($rs_members);
$totalRows_rs_members = mysql_num_rows($rs_members);
?>
<?php require_once("webassist/email/mail_php.php"); ?>
<?php require_once("webassist/email/mailformatting_php.php"); ?>
<?php
if ((isset($_POST["submit1"]) || isset($_POST["submit1_x"]))) {
//WA Universal Email object="mail"
@session_write_close();
@set_time_limit(0);
$EmailRef = "waue_emailgroup_1";
$BurstSize = 50;
$BurstTime = 1;
$WaitTime = 1;
$GoToPage = "?success=true";
$RecipArray = array();
$StartBurst = time();
$LoopCount = 0;
$TotalEmails = 0;
$RecipIndex = 0;
// build up recipients array
$CurIndex = sizeof($RecipArray);
$RecipArray[$CurIndex] = array();
$RecipArray[$CurIndex][] = $row_rs_members;
$RecipArray[$CurIndex][] = $rs_members;
$RecipArray[$CurIndex][] = "EmailAddress";
$TotalEmails += mysql_num_rows($rs_members);
$RealWait = ($WaitTime<0.25)?0.25:($WaitTime+0.1);
$TimeTracker = Array();
$TotalBursts = floor($TotalEmails/$BurstSize);
$AfterBursts = $TotalEmails % $BurstSize;
$TimeRemaining = ($TotalBursts * $BurstTime) + ($AfterBursts*$RealWait);
if ($TimeRemaining < ($TotalEmails*$RealWait) ) {
$TimeRemaining = $TotalEmails*$RealWait;
}
writeUEProgress($EmailRef,0,$TotalEmails,$TimeRemaining);
while ($RecipIndex < sizeof($RecipArray)) {
$EnteredValue = is_string($RecipArray[$RecipIndex][0]);
$CurIndex = 0;
while (($EnteredValue && $CurIndex < sizeof($RecipArray[$RecipIndex])) || (!$EnteredValue && $RecipArray[$RecipIndex][0])) {
$starttime = microtime_float();
if ($EnteredValue) {
$RecipientEmail = $RecipArray[$RecipIndex][$CurIndex];
} else {
$RecipientEmail = $RecipArray[$RecipIndex][0][$RecipArray[$RecipIndex][2]];
}
$EmailsRemaining = ($TotalEmails- $LoopCount);
$BurstsRemaining = ceil(($EmailsRemaining-$AfterBursts)/$BurstSize);
$IntoBurst = ($EmailsRemaining-$AfterBursts) % $BurstSize;
if ($AfterBursts<$EmailsRemaining) $IntoBurst = 0;
$TimeRemaining = ($BurstsRemaining * $BurstTime * 60) + ((($AfterBursts<$EmailsRemaining)?$AfterBursts:$EmailsRemaining)*$RealWait) - (($AfterBursts>$EmailsRemaining)?0:($IntoBurst*$RealWait));
if ($TimeRemaining < ($EmailsRemaining*$RealWait) ) {
$TimeRemaining = $EmailsRemaining*$RealWait;
}
$CurIndex ++;
$LoopCount ++;
writeUEProgress($EmailRef,$LoopCount,$TotalEmails,round($TimeRemaining));
wa_sleep($WaitTime);
include("webassist/email/waue_emailgroup_1.php");
$endtime = microtime_float();
$TimeTracker[] =$endtime - $starttime;
$RealWait = array_sum($TimeTracker)/sizeof($TimeTracker);
if ($LoopCount % $BurstSize == 0 && $CurIndex < sizeof($RecipArray[$RecipIndex])) {
$TimePassed = (time() - $StartBurst);
if ($TimePassed < ($BurstTime*60)) {
$WaitBurst = ($BurstTime*60) -$TimePassed;
wa_sleep($WaitBurst);
}
else {
$TimeRemaining = ($TotalEmails- $LoopCount)*$RealWait;
}
$StartBurst = time();
}
if (!$EnteredValue) {
$RecipArray[$RecipIndex][0] = mysql_fetch_assoc($RecipArray[$RecipIndex][1]);
}
}
$RecipIndex ++;
}
@session_start();
$_SESSION[$EmailRef."_Status"] = $GLOBALS[$EmailRef."_Status"];
$_SESSION[$EmailRef."_Index"] = $GLOBALS[$EmailRef."_Index"];
$_SESSION[$EmailRef."_From"] = $GLOBALS[$EmailRef."_From"];
$_SESSION[$EmailRef."_To"] = $GLOBALS[$EmailRef."_To"];
$_SESSION[$EmailRef."_Subject"] = $GLOBALS[$EmailRef."_Subject"];
$_SESSION[$EmailRef."_Body"] = $GLOBALS[$EmailRef."_Body"];
$_SESSION[$EmailRef."_Header"] = $GLOBALS[$EmailRef."_Header"];
$_SESSION[$EmailRef."_Log"] = $GLOBALS[$EmailRef."_Log"];
if (function_exists("rel2abs")) $GoToPage = $GoToPage?rel2abs($GoToPage,dirname(__FILE__)):"";
if ($GoToPage!="") {
header("Location: ".$GoToPage);
}
}
?>
and this is the javascript for the rich text box
<div id="sample">
<script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script> <script type="text/javascript">
//<![CDATA[
bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
//]]>
</script>
</div>