email_send should send html version of email if we have it, also dont translate the subject & body thorugh i18n()

This commit is contained in:
james 2011-02-17 16:36:17 +00:00
parent dfb54ec9df
commit b71a0dc994

View File

@ -338,8 +338,10 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array()) {
$q=mysql_query("SELECT * FROM emails WHERE val='$val'");
if($r=mysql_fetch_object($q)) {
$subject=i18n($r->subject);
$body=i18n($r->body);
//we dont want to translate these -- the emails themselves should be bi-multi-lingual if they need to be.
$subject=$r->subject;
$body=$r->body;
$bodyhtml=$r->body;
/* Eventually we should just do this with communication_replace_vars() */
if(count($sub_subject)) {
@ -353,6 +355,13 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array()) {
}
}
//do bodyhtml as well
if(count($sub_body)) {
foreach($sub_body AS $sub_k=>$sub_v) {
$bodyhtml=ereg_replace("\[$sub_k\]","$sub_v",$bodyhtml);
}
}
if($r->from)
$fr=$r->from;
else if ($config['fairmanageremail'])
@ -363,7 +372,7 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array()) {
//only send the email if we have a from
if($fr) {
//send using RMail
email_send_new($to,$fr,$subject,$body);
email_send_new($to,$fr,$subject,$body,$bodyhtml);
}
else
echo error(i18n("CRITICAL ERROR: email '%1' does not have a 'From' and the Fair Manager Email is not configured",array($val),array("email key name")));