Hello,
I use the actual version of PHP-Runner.
When I try to send a remind-Mail for password, I get the following error :
Fehlertyp 2
Fehlerbeschreibung mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
URL 213.174.33.163/PHP-ATM-Schüler/remind.php?
Fehlerdatei C:\Program Files\PHPRunner3.1\projects\PHP-ATM-Schüler\output\remind.php
Fehlerzeile 68
SQL Abfrage select `Schueler_ID`,`Passwort`,`Email` from `schueler` where `Schueler_ID`=4416
The SQL-statement is correct.
in php.ini I have the following lines
[mail function]
; For Win32 only.
SMTP = localhost ; for Win32 only
smtp_port = 25
sendmail_from= me@localhost.com ; for Win32 only
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
the source-code of remind.php is (I did not worked at the layout)
<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
set_magic_quotes_runtime(0);
include("include/dbcommon.php");
$cEmailField = "Email";
$reminded=false;
$strSearchBy="username";
include('libs/Smarty.class.php');
$smarty = new Smarty();
$strUsername="";
$strEmail="";
$strMessage="";
if (@$_POST["btnSubmit"] == "Remind")
{
$strSearchBy=$_POST["searchby"];
$strUsername=refine(@$_POST["username"]);
$strEmail=refine(@$_POST["email"]);
$conn=db_connect();
$rstemp=db_query("select * from `schueler` where 1=0",$conn);
$tosearch=false;
if($strSearchBy!="email")
{
$value=$strUsername;
if((string)$value!="")
$tosearch=true;
if(FieldNeedQuotes($rstemp,$cUserNameField))
$value="'".db_addslashes($value)."'";
else
$value=(0+$value);
$sWhere=AddFieldWrappers($cUserNameField)."=".$value;
}
else
{
$value=$strEmail;
if((string)$value!="")
$tosearch=true;
if(FieldNeedQuotes($rstemp,$cEmailField))
$value="'".db_addslashes($value)."'";
else
$value=(0+$value);
$sWhere=AddFieldWrappers($cEmailField)."=".$value;
}
if($tosearch && function_exists("BeforeRemindPassword"))
$tosearch = BeforeRemindPassword($strUsername,$strEmail);
if($tosearch)
{
$strSQL="select ".AddFieldWrappers($cUserNameField).",".AddFieldWrappers($cPasswordField).",".AddFieldWrappers($cEmailField)." from `schueler` where ".$sWhere;
$rs=db_query($strSQL,$conn);
if(db_numrows($rs))
{
$data=db_fetch_numarray($rs);
$password=$data[1];
$message="Password reminder\r\n";
$message.="You asked to remind your username and password at http://".$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]."\r\n";
$message.="User Name: ".$data[0]."\r\n";
$message.="Password: ".$password."\r\n";
mail($data[2],"Password retrieval",$message);
$reminded=true;
if(function_exists("AfterRemindPassword"))
AfterRemindPassword();
if($strSearchBy!="email")
$smarty->assign("params","username=".urlencode($strUsername));
$smarty->display("remind_success.htm");
return;
}
}
if(!$reminded)
{
if($strSearchBy!="email")
$strMessage="Benutzer"." <i>".$strUsername."</i> "."ist nicht registriert.";
else
$strMessage="Diese Email-Adresse ist in unserer Datenbank nicht vorhanden";
}
}
$smarty->assign("strSearchBy","value=\"".$strSearchBy."\"");
if($strSearchBy=="username")
{
$smarty->assign("checked_username","checked");
$smarty->assign("checked_email","");
$smarty->assign("searchby_disabled","email");
}
else
{
$smarty->assign("checked_username","");
$smarty->assign("checked_email","checked");
$smarty->assign("searchby_disabled","username");
}
$smarty->assign("strUsername","value=\"".htmlspecialchars($strUsername)."\"");
$smarty->assign("strEmail","value=\"".htmlspecialchars($strEmail)."\"");
$smarty->assign("message",@$strMessage);
$smarty->display("remind.htm");
It.s equal wether I delete or not delete the lines in dbcommon.php
// if($cFrom)
// ini_set("sendmail_from",$cFrom);
The result error is the same.
Any idea what's going wrong ?
By the way : this is the best version : I did not found other errors and I will surely update !!
Best regards
Uwe Pfeiffer