我的 joomla 网站上有一个联系表 - 但由于某种原因,电子邮件突然开始出现 %22、%40、%0A 之类的东西,而不是符号?
我尝试过使用 htmlspecialchars_decode 和其他一些选项,但除了使用 str_replace 之外似乎无法摆脱它们,但显然这不会摆脱所有字符。谁能帮我吗?不知道为什么突然变了。
这是我的联系表格:
<form name="contact" id="contact">
<div id="contactForm">
<div class="information">
<div class="__left">Name: *</div>
<div class="__right"><input type="text" name="name" id="name" class="inputbox required" /></div>
<div class="clear"></div>
</div>
<div class="information">
<div class="__left">Email: *</div>
<div class="__right"><input type="text" name="email" id="email" class="inputbox required email" /></div>
<div class="clear"></div>
</div>
<div class="information">
<div class="__left">Phone: *<br /><em>(Please include area code - XX XXXX XXXX)</em></div>
<div class="__right"><input type="text" name="phone" id="phone" class="inputbox required phone" /></div>
<div class="clear"></div>
</div>
<div class="information">
<div class="__left">Message: *</div>
<div class="__right"><textarea name="message" id="message" rows="10" class="inputbox required"></textarea></div>
<div class="clear"></div>
</div>
<div class="__right"><input type="submit" name="submit" id="submit" value="Submit" class="button" /></div>
<div class="clear"></div>
</div>
</form>
这是php:
$name = htmlspecialchars_decode(JRequest::getVar('e_name'));
$email = htmlspecialchars_decode(str_replace('%40','@',JRequest::getVar('e_email')));
$phone = htmlspecialchars_decode(JRequest::getVar('e_phone'));
$body = htmlspecialchars_decode(str_replace('%0A','<br />',JRequest::getVar('e_message')));
//send an email
$emailto = $emailto;
$emailfrom = $email;
$emailfromname = $name;
$subject = $subject;
# prepare email body text
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>'. $subject .'</title>
</head>
<body>
<p>'. $body .'</p>
<hr />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="300" align="left" valign="top">Name:</td>
<td align="left" valign="top">'. $name .'</td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td align="left" valign="top">Email:</td>
<td align="left" valign="top">'. $email .'</td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td align="left" valign="top">Phone:</td>
<td align="left" valign="top">'. $phone .'</td>
</tr>
</table>
</body>
</html>';
// send email
if (JUtility::sendMail($emailfrom, $emailfromname, $emailto, $subject, $message, 1, $cc, $bcc, $attachment, $replyto, $replytoname)) {
$response[] = 1;
} else {
$response[] = 0;
};