0
我需要测试一个用于发送邮件的php脚本。我复制从PHPMailer的不同行为php代码
Ç运行代码:\的Inetpub \ wwwroot的\ WWW \销售\ send_test_mail.php
到
C:\的Inetpub \ wwwroot的\ WWW \ prd_reques \ provaMail.php
这些代码是由一个IIS 8服务器与PHP 5.3.28执行。代码如下:
<?php
//require './PHPMailerAutoload.php';
// start PHPMailerAutoload.php
function PHPMailerAutoload($classname)
{
//Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) {
require $filename;
}
}
spl_autoload_register('PHPMailerAutoload');
// end PHPMailerAutoload.php
$mail = new PHPMailer(true);
$mail->AddAddress("[email protected]");
$mail->MsgHTML("TEST old server");
try
{
$mail->Subject = "TEST INTERPLANET";
$mail->SetFrom("[email protected]");
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "mail.interplanet.it"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "username"; // SMTP account username
$mail->Password = "password"; // SMTP account password
$result = $mail->Send();
}
catch (phpmailerException $e)
{
echo $e->errorMessage(); //Pretty error messages from PHPMailer
}
catch (Exception $e)
{
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
我想了解这种现象的原因......
更新1 我添加代码PHPMailerAutoload.php脚本
当你运行代码时会发生什么?你期望什么?一个可能的问题可能是使用相对路径的'require'语句...... – user2393256
您需要说出“不同的行为”是什么。 – Synchro
_send_test_mail.php_脚本在尝试_Mail.php_ no时运行时发送邮件。 – salem