php发送有崩溃文本文件的电子邮件

时间:2016-04-25 10:08:32

标签: php

每次运行脚本时,我都会收到以下crash.txt文件 我在发送php邮件时使用IIS 我尝试php邮件程序,smtp和PHPMailerAutoload但它都没有工作,所有输出与相同的crash.txt 下面是崩溃文件的样本

registered owner  : Microsoft / Microsoft
operating system  : Windows 7 x64 Service Pack 1 build 7601
system language   : English
system up time    : 5 hours 1 minute
program up time   : 5 minutes
processors        : 4x Intel(R) Core(TM) i3-4160 CPU @ 3.60GHz
physical memory   : 1186/3968 MB (free/total)
free disk space   : (C:) 116.21 GB
display mode      : 1024x768, 32 bit
process id        : $1e74
allocated memory  : 10.56 MB
executable        : sendmail.exe
exec. date/time   : 2011-06-18 01:10
compiled with     : Delphi 2006/07
madExcept version : 3.0l
callstack crc     : $205f8196, $4436e8c2, $4436e8c2
exception number  : 1
exception class   : EInOutError
exception message : I/O error 105.

main thread ($203c):
004b675c +18a8 sendmail.exe sendmail         922 +440 initialization
76ee013e +000a ntdll.dll                              KiUserExceptionDispatcher
0040474d +001d sendmail.exe System           262   +0 @AfterConstruction
0043dada +01fe sendmail.exe IdIOHandler     1508  +60 TIdIOHandler.ReadFromSource
0043d559 +0159 sendmail.exe IdIOHandler     1315  +57 TIdIOHandler.ReadLn
0043d380 +0024 sendmail.exe IdIOHandler     1233   +1 TIdIOHandler.ReadLn
0043d837 +0073 sendmail.exe IdIOHandler     1428  +10 TIdIOHandler.ReadLnWait
0044035d +0059 sendmail.exe IdTCPConnection  768   +7 TIdTCPConnection.GetInternalResponse
0043fea3 +0013 sendmail.exe IdTCPConnection  564   +1 TIdTCPConnection.GetResponse
004403fd +002d sendmail.exe IdTCPConnection  788   +4 TIdTCPConnection.GetResponse
0045ab97 +0033 sendmail.exe IdSMTP           375   +4 TIdSMTP.Connect
004b5f14 +1060 sendmail.exe sendmail         808 +326 initialization
769433c8 +0010 kernel32.dll                           BaseThreadInitThunk

thread $2170:
76ef0146 +0e ntdll.dll     NtWaitForMultipleObjects
769433c8 +10 kernel32.dll  BaseThreadInitThunk

thread $1824:
76ef1f2f +0b ntdll.dll     NtWaitForWorkViaWorkerFactory
769433c8 +10 kernel32.dll  BaseThreadInitThunk

这是我的代码:

<?php
require_once('class.phpmailer.php');
$mail = new PHPMailer();

$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "smtp.gmail.com";
$mail->Port = 587; // or 587
$mail->IsHTML(true);
$mail->Username = 'user@gmail.com';
$mail->Password = 'pass';
$mail->SetFrom("user@gmail.com");
$mail->Subject = "Test";
$mail->Body = "hello";
$mail->AddAddress("senduser@company.com");

// if(!$mail->Send()) {
//     echo "Mailer Error: " . $mail->ErrorInfo;
//  } else {
//     echo "Message has been sent";
//  }
print_r($mail->Send());
?> 

4 个答案:

答案 0 :(得分:3)

PHPMailer exampels中,代码中缺少一行: $mail->isSMTP(); // Set mailer to use SMTP

答案 1 :(得分:0)

please check your smtp_host name

like this

<?php
require_once('class.phpmailer.php');
$mail = new PHPMailer();

$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "ip-111-133-133-100.ip.secureserver.net";
$mail->Port = 587; // or 587
$mail->IsHTML(true);
$mail->Username = 'user@gmail.com';
$mail->Password = 'pass';
$mail->SetFrom("user@gmail.com");
$mail->Subject = "Test";
$mail->Body = "hello";
$mail->AddAddress("senduser@company.com");

// if(!$mail->Send()) {
//     echo "Mailer Error: " . $mail->ErrorInfo;
//  } else {
//     echo "Message has been sent";
//  }
print_r($mail->Send());
?> 

答案 2 :(得分:0)

问题中列出的代码需要一次更改

$port = "465";

enter image description here

答案 3 :(得分:0)

您的PHP代码看起来不错。您是否在sendmail.exe上配置了Application Pool Identity并允许执行权限?