我写了这个php邮件发件人代码:
<?php
if($_SERVER["REQUEST_METHOD"] === "POST") {}
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$subject = $_POST['subject'];
$mailFrom = $_POST['mail'];
$phone = $_POST['phone'];
$company = $_POST['company'];
$website = $_POST['website'];
$message = $_POST['message'];
$recaptcha_secret = "xy";
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_POST['g-recaptcha-response']);
$response = json_decode($response, true);
if($response["success"] === true){
$mailTo = "[email protected]";
$headers = "From: ".$mailFrom;
$txt = "Feladó: ".$name."\nTelefonszám: ".$phone."\nCég: ".$company."\nWeboldal: ".$website."\n\nÜzenet: ".$message;
mail($mailTo, $subject, $txt, $headers);
header("Location: feedback/koszonjuk");
}else{
header("Location: feedback/error");
}
}
?>`
它发送电子邮件到我的服务器端的电子邮件地址后,有人填写我的表格在我的网站与recaptcha。
我想有UTF-8字符编码的电子邮件,但我看不到这个问题。这些字符在表单的电子邮件中管理不当:öüóőúéá
表单所在的HTML页面设置为UTF-8。HTML表单代码:
<form action="ajanlatkeres.php" method="post" class="ajanlatkeres-form" accept-charset="utf-8">
<h2>Általános adatok</h2>
<input type="text" name="name" placeholder="Teljes név*" class="feedback-input" required>
<input type="text" name="mail" placeholder="E-mail*" class="feedback-input" required>
<input type="text" name="phone" placeholder="Telefonszám*" class="feedback-input" required>
<h2>Vállalkozás adatai</h2>
<input type="text" name="company" placeholder="Márkanév" class="feedback-input">
<input type="text" name="website" placeholder="Weboldal" class="feedback-input">
<h2>Üzenet</h2>
<input type="hidden" name="subject" value="Ajánlatkérés">
<textarea name="message" placeholder="Írj pár sort projektedről*" class="feedback-input" required></textarea>
<div class="g-recaptcha" id="rcaptcha" data-theme="dark" data-sitekey="xy"></div>
<br/>
<button id="submit_form" class="contactbutton" type="submit" name="submit">Küldés</button>
</form>
什么原因会导致此问题?这是我的PHP代码吗?
1条答案
按热度按时间vm0i2vca1#
您可以尝试更改标题:
和