In following code
$email_addr = ‘
$emailAddr2 = “”.$_SESSION[“ThisEmp”][“email”].””; Doesn’t work. I tried by removing “” also.
And echo ”.$emailAddr2; echos my email address. That means session variable is set. What might be reason?
And catch block is not getting executed it is not throwing any error also.
$headers = “From: [email][email protected]
$emltpl = ‘templates/email_new_employer.txt’;
$template = file_get_contents($emltpl);
$tp1 = str_replace(‘<username>’, $_SESSION[“ThisEmp”][“username”], $template);
$tp2 = str_replace(‘<password>’, $_SESSION[“ThisEmp”][“email”], $tp1);
$tp3 = str_replace(‘<empname>’, $_SESSION[“ThisEmp”][“empname”], $tp2);
echo ’email template’.$tp3;
$email_addr = ‘
$emailAddr2 = “”.$_SESSION[“ThisEmp”][“email”].””;
echo ”.$emailAddr2;
try{
mail(”.$emailAddr2.”, ‘Your account information session’, $tp3, $headers);
}
catch (Exception $x)
{
echo “There is error in sending mail”. $x->getMessage( );
exit();
}
mail($email_addr, ‘Your account information’, $tp3, $headers);