2

I have this really weird issue that am troubled with and do not know how to fix it!

Sample code i used here Wroks and sends me the email correctly!

<?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>");
}
?>

But when i put this code into a email password reminder php code it stops working! i have put the code at the very front or at the place where u click to send button to trigger, nothing works and i have no idea why! the funny part is i had it working if i slowly copy in parts of the code and it WORKS for about the first one or two email and it stops working after...

the code that comes before the reminder.php before the email script is below

<?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);

Please ! if you have any idea on the solution to this?

4

1 回答 1

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

检查这是否有效?

于 2014-06-10T15:40:51.140 回答