当您单击提交按钮时,我尝试通过电子邮件发送 html 中的数据,该 html 表单使用 POST 操作。我的php代码是:
<?php
$email = $_POST['email'];
$to = '$email'; //email submitted in html form
$subject = 'Welcome ';
$message = 'hello';
$headers = 'From: myaddress@email.com' . "\r\n".
'Reply-To: From: myaddress@email.com' . "\r\n".
'X-Mailer: PHP/' . phpversion();
$result = mail($to, $subject, $message, $headers);
if(!$result) {
echo "Error";
} else {
echo "Success";
}
?>
我收到一条成功消息,但没有收到电子邮件,任何想法将不胜感激。非常感谢