首页 > 解决方案 > PHP 联系表单提交错误

问题描述

在此表单提交中,我遇到了一些错误。

1. The mail is working. But Contact form submit details not showing.
2. Its working on only gmail. Like : abc@gmail.com
3. Not working on the domain like lucky@abc.com. The mail not working. 

请给任何建议。

<?php

       $Name = trim(strip_tags($_POST['Name']));
       $Email = trim(strip_tags($_POST['Email']));
       $Phone = trim(strip_tags($_POST['Phone']));
       $Subject = trim(strip_tags($_POST['Subject']));
       $Message = htmlentities($_POST['Message']);

       // set here
       $subject = "Contact form submitted!";
       $to = 'lachchanderdagar@gmail.com';

       $body = <<<HTML
$message
HTML;

       $headers = "From: $email\r\n";
       $headers .= "Content-type: text/html\r\n";

       // send the email
       mail($to, $subject, $body, $headers);

       // redirect afterwords, if needed
       header('Location: thanksforcontact.php');
?>

标签: phphtml

解决方案


推荐阅读