使用PHPMailer发送的电子邮件卡在SMTP队列文件夹中

时间:2014-01-09 16:07:52

标签: php smtp windows-server-2012

我的网站上有一个表单,会将结果发送到特定的电子邮件地址。表单工作正常(我认为),但电子邮件卡在队列文件夹服务器端。我将SMTP服务器设置为无身份验证,并将其设置为允许来自所有IP的连接。 25号港口也开放。

服务器管理器事件日志中没有报告事件,我在SMTP日志中看不到任何报告。当我telnet发送电子邮件时,同样的事情发生了。电子邮件已发送但它卡在队列文件夹中。

以下是SMTP日志的一部分:

#Date: 2014-01-09 15:14:31
#Fields: date time c-ip cs-username s-sitename s-computername s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status sc-win32-status sc-bytes cs-bytes time-taken cs-version cs-host cs(User-Agent) cs(Cookie) cs(Referer) 
2014-01-09 15:14:31 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 HELO - +i360NonAutoWeb.corp.interactive360.com 250 0 33 43 0 SMTP - - - -
2014-01-09 15:14:31 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 MAIL - +FROM:<dbass@interactive360.com> 250 0 49 36 0 SMTP - - - -
2014-01-09 15:14:31 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 RCPT - +TO:<dbass@interactive360.com> 250 0 37 34 0 SMTP - - - -
2014-01-09 15:14:31 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 DATA - +<43d1d1eccd3453e5a8c44089d756075e@www.interactive360.com> 250 0 141 16333 15 SMTP - - - -
2014-01-09 15:14:31 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 QUIT - i360NonAutoWeb.corp.interactive360.com 240 15 58 4 0 SMTP - - - -
2014-01-09 15:16:14 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 HELO - +i360NonAutoWeb.corp.interactive360.com 250 0 33 43 0 SMTP - - - -
2014-01-09 15:16:14 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 MAIL - +FROM:<dbass@interactive360.com> 250 0 49 36 0 SMTP - - - -
2014-01-09 15:16:14 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 RCPT - +TO:<dbass@interactive360.com> 250 0 37 34 0 SMTP - - - -
2014-01-09 15:16:14 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 DATA - +<18cb24d6e70e9c3bd553afb56e7fb88f@www.interactive360.com> 250 0 141 16333 32 SMTP - - - -
2014-01-09 15:16:14 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 QUIT - i360NonAutoWeb.corp.interactive360.com 240 32 58 4 0 SMTP - - - -
2014-01-09 15:23:05 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 HELO - +i360NonAutoWeb.corp.interactive360.com 250 0 33 43 0 SMTP - - - -
2014-01-09 15:23:05 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 MAIL - +FROM:<dbass@interactive360.com> 250 0 49 36 0 SMTP - - - -
2014-01-09 15:23:05 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 RCPT - +TO:<dbass@interactive360.com> 250 0 37 34 0 SMTP - - - -
2014-01-09 15:23:05 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 DATA - +<a1e1efef337e951b5f023df8d3efba7b@www.interactive360.com> 250 0 141 16329 31 SMTP - - - -
2014-01-09 15:23:05 127.0.0.1 i360NonAutoWeb.corp.interactive360.com SMTPSVC1 I360NONAUTOWEB 127.0.0.1 0 QUIT - i360NonAutoWeb.corp.interactive360.com 240 31 58 4 0 SMTP - - - -

这是我的PHP表单:

<?php

 require_once('assets/PHPMailer/class.phpmailer.php');

 $first_name = $_POST['first_name'];
 $last_name = $_POST['last_name'];
 $phone = $_POST['phone'];
 $email = $_POST['email'];
 $job = $_POST['job'];
 $file = $_FILES['fileUpload']['name'];


 $mail = new PHPMailer();
 $mail->From = "dbass@interactive360.com";
 $mail->FromName  =  "Interactive 360 Job Form";
 $mail->AddAddress("dbass@interactive360.com","Job Form");

 $mail->WordWrap = 50;  

 $mail->Subject = "Interactive 360 Job Form";
 $mail->Body="
            First Name: $first_name
            Last Name: $last_name
            Phone Number: $phone
            Email: $email
            Job: $job";

 $maxsize = 2 * 1024 * 1024;
 $types = array('application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');


 if ((isset($_FILES['fileUpload']) && $_FILES['fileUpload']['error'] == UPLOAD_ERR_OK) && $_FILES['fileUpload']['size'] < $maxsize && in_array( $_FILES['fileUpload']['type'], $types)) 
 {
  $mail->AddAttachment($_FILES['fileUpload']['tmp_name'],
                         $_FILES['fileUpload']['name']);
 } 
 else 
 {
  header("Refresh: 3; URL=http://www.interactive360.com/join-our-team.php");
  echo 'Please upload a PDF or Word Document that is under 2MB';
  exit();
 }

 $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
 if(!preg_match($email_exp,$email)) 
 {
   header("Refresh: 3; URL=http://www.interactive360.com/join-our-team.php");
   echo 'Please enter a valid email address';
   exit();
 }

 if($first_name == '') 
 {
   header("Refresh: 2; URL=http://www.interactive360.com/join-our-team.php");
   echo 'Please enter your first name';
   exit();
 }

 if($last_name == '') 
 {
   header("Refresh: 2; URL=http://www.interactive360.com/join-our-team.php");
   echo 'Please enter your last name';
   exit();
 }

 if(!$mail->Send())
 {
   echo 'Message was not sent.';
   echo 'Mailer error: ' . $mail->ErrorInfo;
 }
 else
 {
   header("Refresh: 2; URL=http://www.interactive360.com/");
   echo 'Thank you for your feedback.';
 }    
?>

0 个答案:

没有答案