私のphp/html Webサイトの連絡先ページがあり、mail関数を使用してphpでhtmlメールを送信しようとしていますが、メールが送信されず、エラーは発生しません。
これは私のコードです:
<?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);
}
?>
サーバーにアップロードするときに問題が発生するため、「swift」や「phpmailer」などのメールプラグインを使用したくありません。