Html php xmailer的问题?我不知道';我不这么认为';s语法
代码:Html php xmailer的问题?我不知道';我不这么认为';s语法,html,forms,php,Html,Forms,Php,代码: 不发送电子邮件,过去也是这样。我想知道是什么改变了?也许托管公司在我不知道的情况下更新了php或其他东西?我真的迷路了。也许我忽略了什么,也许是语法。我希望你们都能帮忙!提前谢谢 我尝试了你的代码,修改表单中的数据,效果很好。错误并非如您所怀疑的那样来自语法 我的猜测是:您的sendmail已断开或路径错误(/usr/sbin/sendmail)。如果您在自己的服务器上工作,请使用 phpinfo() 如果它是一个托管服务(我知道这是你的情况),然后联系支持,因为这是一个服务器问题
不发送电子邮件,过去也是这样。我想知道是什么改变了?也许托管公司在我不知道的情况下更新了php或其他东西?我真的迷路了。也许我忽略了什么,也许是语法。我希望你们都能帮忙!提前谢谢 我尝试了你的代码,修改表单中的数据,效果很好。错误并非如您所怀疑的那样来自语法 我的猜测是:您的sendmail已断开或路径错误(/usr/sbin/sendmail)。如果您在自己的服务器上工作,请使用 phpinfo() 如果它是一个托管服务(我知道这是你的情况),然后联系支持,因为这是一个服务器问题 如果您有ssh访问此类托管服务的权限,请访问该服务并使用以下命令执行脚本:
<?php
session_start();
$name = htmlspecialchars($_POST['name']);
$phone = htmlspecialchars($_POST['phone']);
$email = htmlspecialchars($_POST['email']);
$staddress = htmlspecialchars($_POST['staddress']);
$city = htmlspecialchars($_POST['city']);
$state = htmlspecialchars($_POST['state']);
$zipcode = htmlspecialchars($_POST['zipcode']);
$eventtype = htmlspecialchars($_POST['eventtype']);
$guests = htmlspecialchars($_POST['guests']);
$month = htmlspecialchars($_POST['month']);
$day = htmlspecialchars($_POST['day']);
$year = htmlspecialchars($_POST['year']);
$hourstart = htmlspecialchars($_POST['hourstart']);
$hourfinish = htmlspecialchars($_POST['hourfinish']);
$eventstreet = htmlspecialchars($_POST['eventstreet']);
$eventcity = htmlspecialchars($_POST['eventcity']);
$eventstate = htmlspecialchars($_POST['eventstate']);
$eventzip = htmlspecialchars($_POST['eventzip']);
$howwereu = htmlspecialchars($_POST['howwereu']);
$custmsg = htmlspecialchars($_POST['custmsg']);
$date = date('m-d-Y');
$to = '' . $email . '';
$subject = 'Thanks,' .$name . ' for requesting a quote!';
$message = "We will contact you as soon as possible! ";
$headers = 'From: no-reply@xxx.com' . "\r\n" .
'Reply-To: xxx@xxx.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
$to2 = 'xxx@xxx.com';
$subject2 = '' . $name . ' has requested a quote!';
$message2 = '
<html>
<head>
<title>Contact Email</title>
</head>
<body>
<p>Here is the information provided. If the field is blank, the customer did not fill out the
form.</p>
<table>
<tr>
<td>Customer Name:</td>
<td>' . $name . '</td>
</tr>
<tr>
<td>Customer Email:</td>
<td>' . $email . '</td>
</tr>
<tr>
<td>Customer Phone:</td>
<td>' . $phone . '</td>
</tr>
<tr>
<td>Customer Street Address:</td>
<td>' . $staddress . '</td>
</tr>
<tr>
<td>Customer City:</td>
<td>' . $city . '</td>
</tr>
<tr>
<td>Customer State:</td>
<td>' . $state . '</td>
</tr>
<tr>
<td>Customer Zipcode:</td>
<td>' . $zipcode . '</td>
</tr>
<tr>
<td>Event Type:</td>
<td>' . $eventtype . '</td>
</tr>
<tr>
<td># of Guests:</td>
<td>' . $guests . '</td>
</tr>
<tr>
<td>Event Month:</td>
<td>' . $month . '</td>
</tr>
<tr>
<td>Event Day:</td>
<td>' . $day . '</td>
</tr>
<tr>
<td>Event Year:</td>
<td>' . $year . '</td>
</tr>
<tr>
<td>Event Start Hour:</td>
<td>' . $hourstart . '</td>
</tr>
<tr>
<td>Event Finish Hour:</td>
<td>' . $hourfinish . '</td>
</tr>
<tr>
<td>Event Street:</td>
<td>' . $eventstreet . '</td>
</tr>
<tr>
<td>Event City:</td>
<td>' . $eventcity . '</td>
</tr>
<tr>
<td>Event State:</td>
<td>' . $eventstate . '</td>
</tr>
<tr>
<td>Event Zip:</td>
<td>' . $eventzip . '</td>
</tr>
<tr>
<td>How were you referred:</td>
<td>' . $howwereu . '</td>
</tr>
<tr>
<td>Customer Message:</td>
<td>' . $custmsg . '</td>
</tr>
</table>
</body>
</html>
';
$header2 = 'MIME-Version: 1.0' . "\r\n";
$header2 .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header2 .= 'From: no-reply@xxx.com' . "\r\n";
$header2 .= 'Reply-To: xxx@xxx.com' . "\r\n";
$header2 .= 'X-Mailer: PHP Version: 5.0+' . "\r\n";
mail($to2, $subject2, $message2, $header2);
header('Location: http://www.xxxx.com');
?>
加上错误报告,它可能会给你一个关于bin文件发生了什么的跟踪我可以确认这不是一个语法问题(用php-l检查)。。但是我认为您应该尽量避免发布可能由语法错误引起的问题:)也许您可以检查
mail()
是否返回true或false?打开并查看是否生成了任何警告?检查服务器上的邮件日志以查看邮件是否已发送?再加上sammitch所说的,您正试图发送两封邮件,因此请检查这两封邮件这里发生了什么?它起作用了吗?
php -q *[yourScript.php]*