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