好的,我是 php 编码的新手,并且正在处理表单邮件 php(将内容邮寄到电子邮件地址的表单)代码工作正常。现在我想知道是否有办法通知访问者邮件的成功或失败。(动态添加一行到表单页面,其中提到“成功”或“失败重试”。希望我已经足够清楚了。
这是代码
<?php
$name = $_POST["name"];
$company = $_POST["company"];
$email = $_POST["email"];
$contact =$_POST["contact"];
$require = $_POST["requirement"];
$message = "Name :".$name."\n"."Company :".$company."\n"."Email id".$email."\n"."Contact no :".$contact."\n"."Requirement : ".$require;
$subject ="Subject Matter Here";
$to = "abc@xyz.com";
if(mail($to, $subject,$message)){
echo "We Received Your enquiry, We'll get back to you soon";
}
else{
echo "there were some errors sending enquiry, please try again";
}
?>