0){ $email=true; }elseif(isset($prefs['emailonmail']) && $prefs['emailonmail'] && $from==0 && isset($prefs['systemmail']) && $prefs['systemmail']){ $email=true; } $emailadd = ""; if (isset($row['emailaddress'])) $emailadd = $row['emailaddress']; if (!is_email($emailadd)) $email=false; if ($email && !$noemail){ if ($serialized&2){ $body = unserialize(stripslashes($body)); $body = translate_mail($body,$to); } if ($serialized&1){ $subject = unserialize(stripslashes($subject)); $subject = translate_mail($subject,$to); } $sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid='$from'"; $result = db_query($sql); $row1=db_fetch_assoc($result); db_free_result($result); if ($row1['name']!="") $fromline=full_sanitize($row1['name']); else $fromline=translate_inline("The Green Dragon","mail"); $sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid='$to'"; $result = db_query($sql); $row1=db_fetch_assoc($result); db_free_result($result); $toline = full_sanitize($row1['name']); // We've inserted it into the database, so.. strip out any formatting // codes from the actual email we send out... they make things // unreadable $body = preg_replace("'[`]n'", "\n", $body); $body = full_sanitize($body); $subject = htmlentities($subject, ENT_COMPAT, getsetting("charset", "ISO-8859-1")); $mailsubj = translate_mail(array("New LoGD Mail (%s)", $subject),$to); $mailbody = translate_mail(array("You have received new mail on LoGD at http://%s`n`n" ."-=-=-=-=-=-=-=-=-=-=-=-=-=-`n" ."From: %s`n" ."To: %s`n" ."Subject: %s`n" ."Body: `n%s`n" ."-=-=-=-=-=-=-=-=-=-=-=-=-=-" ."`nDo not respond directly to this email, it was sent from the game email address, and not the email address of the person who sent you the " ."message. If you wish to respond, log into Legend of the Green Dragon at http://%s .`n`n" ."You may turn off these alerts in your preferences page, available from the village square.", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']), $fromline, $toline, full_sanitize(stripslashes($subject)), stripslashes($body), $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']) ),$to); mail($row['emailaddress'],$mailsubj,str_replace("`n","\n",$mailbody),"From: ".getsetting("gameadminemail","postmaster@localhost")); } invalidatedatacache("mail-$to"); } ?>