我有一个网站正在运行,但似乎无法让 php 发送表单数据。有时会收到感谢信息,但从未出现在邮件中。我的目标是让表单收集数据,然后通过电子邮件将数据发送给客户。
谢谢你的帮助。我正在努力掌握它会出现的 php。
<?php
$to = "********@*******.com";
$subject = "Contact Us";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['enquiry'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully";}
else
{print "We encountered anerror sending your mail";}
?>
<section class="container">
<section class="col-lg-6 col-lg-offset-1">
<form class="form-horizontal text-center" role="form" method="post" action="form_send.php">
<div class="form-group">
<label for="Name" class="col-lg-2 control-label">Name:</label>
<div class="col-lg-6">
<input type="name" class="form-control" id="name" name="name" placeholder="Enter Name...">
</div>
</div>
<div class="form-group">
<label for="Email" class="col-lg-2 control-label">Email:</label>
<div class="col-lg-6">
<input type="email" class="form-control" id="email" name="email" placeholder="Enter Email...">
</div>
</div>
<div class="form-group">
<label for="Phone" class="col-lg-2 control-label">Phone:</label>
<div class="col-lg-6">
<input type="phone" class="form-control" id="phone" placeholder="Enter Phone Number...">
</div>
</div>
<div class="form-group">
<label for="Enquiry" class="col-lg-2 control-label">Enquiry:</label>
<div class="col-lg-6">
<textarea type="enquiry" class="form-control" rows="5" id="enquiry" name="enquiry" placeholder="Enter Email..."></textarea>
</div>
</div>
<div class="form-group">
<label for="Enquiry" class="col-lg-2 control-label"></label>
<div class="col-lg-6">
<button class="btn btn-primary" type="submit">Send Message</button>
</div>
</div>
</form>
来自电子邮件服务器的回复:
永久失败的技术细节:Google 试图传递您的消息,但它被 aspmx.l.google.com 的收件人域 peoplespropertyshop.co.uk 的服务器拒绝。[2607:f8b0:4003:c02::1a]。其他服务器返回的错误是:550-5.1.1 您尝试访问的电子邮件帐户不存在。请尝试 550-5.1.1 仔细检查收件人的电子邮件地址是否有拼写错误或 550-5.1.1 不必要的空格。如需了解详情,请访问 550 5.1.1 support.google.com/mail/bin/answer.py?answer=6596 t6si822722oei.44 - gsmtp