真奇怪博士邮件::工厂问题


Really weird Php Mail::factory Issue

我遇到了一个非常奇怪的问题,我不知道如何解决它!

我在这里使用的示例代码正确地编写并发送给我电子邮件!

<?php
require_once "Mail.php";
$from = "Web Master <contact@sample.com>";
$to = "bob <sample@sample.com>";
$subject = "Test email using PHP SMTP'r'n'r'n";
$body = "This is a test email message";
$host = "mail.emailsrvr.com";
$username = "sample@sample.com";
$password = "11111";
$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
} else {
  echo("<p>Message successfully sent!</p>");
}
?>

但是当我把这个代码放入电子邮件密码提醒php代码时,它就停止工作了!我把代码放在最前面或你点击发送按钮的地方触发,什么都不起作用,我不知道为什么!有趣的是,如果我慢慢地复制部分代码,它就会起作用对于大约第一封或两封电子邮件,它在。。。

电子邮件脚本之前的reminder.php之前的代码在下面

<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
if(get_magic_quotes_runtime())
{
    set_magic_quotes_runtime(false);
}
include("include/dbcommon.php");
$cEmailField = "email";
$reminded=false;
$strSearchBy="username";
include('libs/Smarty.class.php');
$smarty = new Smarty();
$strUsername="";
$strEmail="";
$strMessage="";
$conn=db_connect();
//  Before Process event
if(function_exists("BeforeProcessRemindPwd"))
    BeforeProcessRemindPwd($conn);

求你了!你对解决这个问题有什么想法吗?

mail("sample@sample.com","Test email","test body here");

检查这是否有效?