frenly Posted March 8, 2008 Share Posted March 8, 2008 I have a PHP script where I need to use the session variable $_SESSION['username'] to send email to the address contained in the session variable username. The session variable holds valid email address but when i assign the session variable to another variable and try to send email like- $payer_email=$_SESSION['username']; mail($payer_email, "Your order", $pins); , it does not work But when i test the mail function using my email address directly as- mail ("[email protected]", "Your order", $pins), it works Can somebody point me out what my mistake is in this case? Thanks Link to comment https://forums.phpfreaks.com/topic/95022-problem-using-mail-function/ Share on other sites More sharing options...
amites Posted March 8, 2008 Share Posted March 8, 2008 echo $_SESSION['username']; Link to comment https://forums.phpfreaks.com/topic/95022-problem-using-mail-function/#findComment-486731 Share on other sites More sharing options...
frenly Posted March 8, 2008 Author Share Posted March 8, 2008 how do i use this in the mail function? echo $_SESSION['username'] prints the actual email address but when i assign the value to another variable and use it in mail function, it does not work Link to comment https://forums.phpfreaks.com/topic/95022-problem-using-mail-function/#findComment-486768 Share on other sites More sharing options...
frenly Posted March 8, 2008 Author Share Posted March 8, 2008 so sad noone seems interested to help Link to comment https://forums.phpfreaks.com/topic/95022-problem-using-mail-function/#findComment-486970 Share on other sites More sharing options...
BlueSkyIS Posted March 8, 2008 Share Posted March 8, 2008 there is no obvious problem. it should work as stated. it works for me. Link to comment https://forums.phpfreaks.com/topic/95022-problem-using-mail-function/#findComment-486974 Share on other sites More sharing options...
uniflare Posted March 8, 2008 Share Posted March 8, 2008 echo $_SESSION['username']; echo the session variable to see if the email address is correct before mailing. Link to comment https://forums.phpfreaks.com/topic/95022-problem-using-mail-function/#findComment-486978 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.