[英]Email not sending in contact form
i have a contact page for my php/html website and i am trying to send an html email in php using the mail function but the email never goes through i don't get any errors. 我有一个关于php / html网站的联系页面,我正在尝试使用邮件功能在php中发送html电子邮件,但该电子邮件从未通过,我没有收到任何错误。
This is my code: 这是我的代码:
<?php
$required = array('FirstName', 'LastName', 'Email', 'Subject', 'Message');
if (isset($_POST['Submit']))
{
foreach ( $required as $formfield )
{
if (empty($_POST[$formfield]))
{
header("Location: contact.html");
die();
}
}
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Email = $_POST['Email'];
$Subject = $_POST['Subject'];
$Message = $_POST['Message'];
$To = "edjoks3000@rocketmail.com";
$From = $Email;
//begin of HTML message
$Message = <<<EOF
<html>
<body bgcolor="#DCEEFC">
$Message
</body>
</html>
EOF;
$Headers = "From: $From\r\n";
$Headers .= "Content-type: text/html\r\n";
// Sending the mail
mail($To, $Subject, $Message, $Headers);
}
?>
I've been trying for a while now and have not been able to do this and i do not want to use mail plugins like 'swift' or 'phpmailer' since i get issues with them when i upload to the server. 我已经尝试了一段时间,但无法执行此操作,并且我不想使用“ swift”或“ phpmailer”之类的邮件插件,因为当我将其上传到服务器时遇到了问题。
EOF
更改为EOF;
后缺少分号EOF;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.