送信フォームの PHP コードの問題を理解しようとしているのですが、友人のためにやっています。メールを送信していますが、問題は、受信者が非常に奇妙なメールアドレスを取得することです。画像を添付して詳しく見ていきます。
私のPHPコードは次のとおりです。
<?php
$error = false;
$sent = false;
if(isset($_Post['name'])) {
if(empty($_Post['name']) || empty($_Post['email']) || empty($_Post['comments'])) {
$error = true;
} else {
$to = "linardsberzins@gmail.com";
$name = trim($_Post['name']);
$email = trim($_Post['email']);
$comments = trim($_Post['comments']);
$subject = "Contact Form";
$messages = "Name: $name \r\n Email: $email \r\n Comments: $comments";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From:" . $name . "\r\n";
$mailsent = mail($to, $subject, $messages, $headers);
if($mailsent) {
$sent = true;
}
}
}
?>
どうもありがとう