我有反饋表格。我想發送HTML郵件中的內容。當用戶輸入阿拉伯字符時,它不顯示正確。像تجرOO©用阿拉伯語支持發送電子郵件php
PHP代碼:
function send_email($fromPerson, $fromEmail, $to, $subject, $message) {
$headers = "From: $fromPerson<$fromEmail> \n";
$headers .= "Reply-To: $eMail \r\n";
$headers .= "X-Mailer: PHP/". phpversion();
$headers .= "X-Priority: 3 \n";
$headers .= "MIME-version: 1.0\n";
$headers .= "Content-Type: text/html; charset=UTF-8\n";
$headers .= "Bcc:[email protected]\n";
$msg=$message;
@mail($to, $subject, $msg, $headers);
我試圖直接從PHP代碼發送阿拉伯文和它正確到達,有些東西一樣$msg = "مثال";
的問題是當我提交反饋代碼中的內容時。
<form name="feedb" method="post" action="subscribe.php" onsubmit="return validate_forms();">
<input type="hidden" name="feedback_action" value="feed" />
<div class="fr" style="width:378px;">
<p class="white fs24 mb4">Give Us Your Valuable Feedback</p>
<input name="firstName" id="firstName" type="text" style=" background:#fff; padding:5px; border:none; width:174px; color:#000; font-size:13px;" value="Full Name" onfocus="if(this.value=='Full Name')this.value=''" onblur="if(this.value=='')this.value='Full Name'" />
<input name="email" id="email" type="text" style=" background:#fff; padding:5px; border:none; width:174px; color:#000; font-size:13px; margin-left:5px;" value="Email ID" onfocus="if(this.value=='Email ID')this.value=''" onblur="if(this.value=='')this.value='Email ID'" />
<div class="cb pb8"></div>
<textarea name="comments" id="comments" rows="3" cols="50" style=" background:#fff; padding:5px; border:none; width:366px; color:#000; font-size:13px;" onfocus="if(this.value=='Feedback')this.value=''" onblur="if(this.value=='')this.value='Feedback'">Feedback</textarea>
<div class="ar mt6">
<input type="hidden" name="source" value="feedback" />
<input name="submit" type="image" src="images/sbmt.gif" />
</div>
</div>
</form>
請問,有什麼想法嗎?
大部分時間,它更方便,更容易地使用現有的PHP的一個圖書館發送電子郵件 - 他們已經以正確的方式實施了這些案例(http://swiftmailer.org/,https://code.google.com/a/apache-extras.org/p/phpmailer/) –
提交時使用'escape'關鍵字 – Tarika