This topic is locked
[SOLVED]

 email sending

5/22/2012 9:30:43 AM
PHPRunner General questions
F
Francesco_5000 author

hi,

Recently I have modified a part of my db to store the htaccess passwords of the users, those passwords are encoded in SHA-1 and so on...

in "After password reminder sent" I have wrote an event which has the purpose of sending an email with the .htaccess login to the user:



if(isset($email))

{

$sql2="SELECT password_madre, UserName FROM user WHERE emailUser='".$email."'";

$rs2=CustomQuery($sql2);

$data2=db_fetch_array($rs2);

$password_madre2=$data2["password_madre"];

$username2=$data2["UserName"];

$username2=str_replace(" ","", $username2);
// ********** Send simple email ************
$email="'".$email."'";

$from="technics@adeiaconsulting.it";

$msg="Recupero username e password perimetrale \n

Hai richiesto di ricordare il tuo username e la tua password perimetrale \n

Nome utente: '".$username2."' \n

Password perimetrale: '".$password_madre2."' \n

A seguito di questa mail riceverai anche la username e la password necessarie ad entrare nel database";

$subject="Recupero Password Perimetrale";

$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];

}
elseif(isset($username))

{

$sql1="SELECT password_madre, emailUser FROM user WHERE UserName='".$username."'";

$rs1=CustomQuery($sql1);

$data1=db_fetch_array($rs1);

$password_madre1=$data1["password_madre"];

$email1=$data1["emailUser"];

$username=str_replace(" ","", $username);
// ********** Send simple email ************
$email="'".$email1."'";

$from="technics@adeiaconsulting.it";

$msg="Recupero username e password perimetrale \n

Hai richiesto di ricordare il tuo username e la tua password perimetrale \n

Nome utente: '".$username."' \n

Password perimetrale: '".$password_madre1."' \n

A seguito di questa mail riceverai anche la username e la password necessarie ad entrare nel database";

$subject="Recupero Password Perimetrale";

$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];

}


unfortunately I don't receive that email, because it isn't sent, accordingly with this: http://xlinesoft.com/phprunner/docs/after_password_reminder_sent.htm I can use the "Send simple mail" event in "After password reminder sent". Where am I doing wrong?

Sergey Kornilov admin 5/22/2012

Do you get any error messages? Does it work if you simply send a simple email from this event?

F
Francesco_5000 author 5/23/2012

with some little change the code works fine:



if(isset($email) || ($email!='') || !is_null($email) ) {
$sql2="SELECT password_madre, UserName FROM user WHERE emailUser='".$email."'";

$rs2=CustomQuery($sql2);

$data2=db_fetch_array($rs2);

$password_madre2=$data2["password_madre"];

$username2=$data2["UserName"];

$username2=str_replace(" ","", $username2);
// ********** Send simple email ************
$email=$email;

$from="--rbegin--technics@adeiaconsulting.it--rend--";

$msg="--rbegin--[email]Recupero username e password perimetrale\nHai richiesto di ricordare il tuo username e la tua password perimetrale \n

Nome utente: '".$username2."' \n

Password perimetrale: '".$password_madre2."' \n

A seguito di questa mail riceverai anche la username e la password necessarie ad entrare nel database--rend-- ";

$subject="--rbegin--Recupero Password Perimetrale--rend--";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];

}
if(isset($username) || ($username!='') || !is_null($username))

{

$sql1="SELECT password_madre, emailUser FROM user WHERE UserName='".$username."'";

$rs1=CustomQuery($sql1);

$data1=db_fetch_array($rs1);

$password_madre1=$data1["password_madre"];

$email1=$data1["emailUser"];

$username=str_replace(" ","", $username);
// ********** Send simple email ************

$email=$email1;

$from="--rbegin--technics@adeiaconsulting.it--rend--";
$msg="--rbegin--[username]Recupero username e password perimetrale\nHai richiesto di ricordare il tuo username e la tua password perimetrale \n

Nome utente: ".$username." \n

Password perimetrale: ".$password_madre1." \n

A seguito di questa mail riceverai un'altra mail con la username e la password necessarie ad entrare nel database--rend-- ";
$subject="--rbegin--Recupero Password Perimetrale--rend--";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];
}


by the way there is a function before this block of code that generate a random htaccess password and encode it in SHA-1 .