adhbvklwqdbviabjiawdnbij Posted September 7, 2011 Share Posted September 7, 2011 Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ibn/public_html/emailbomber/actions/sendemails.php on line 8 <?php session_start(); require_once('../includes/link.php'); $errmsg_arr = array(); $errflag = false; mail("$_SESSION['SESS_EMAIL']", "Teste - Enviar Emails", "Olá, ".$_SESSION['SESS_NAME']."\n\nTeste - Enviar Emails, "From Teste"); $errmsg_arr[] = 'Os email serao enviados dentro de no maximo 48 horas.'; $errflag = true; $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: ../users/user/sendemails.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/246642-error-when-sending-email-with-a-_session-as-destinatary/ Share on other sites More sharing options...
voip03 Posted September 7, 2011 Share Posted September 7, 2011 Remove Extra " mail("$_SESSION['SESS_EMAIL']", "Teste - Enviar Emails", "Olá, ".$_SESSION['SESS_NAME']."\n\nTeste - Enviar Emails, "From Teste"); after removing mail("$_SESSION['SESS_EMAIL']", "Teste - Enviar Emails", "Olá, ".$_SESSION['SESS_NAME']."\n\nTeste - Enviar Emails,From Teste"); Quote Link to comment https://forums.phpfreaks.com/topic/246642-error-when-sending-email-with-a-_session-as-destinatary/#findComment-1266481 Share on other sites More sharing options...
adhbvklwqdbviabjiawdnbij Posted September 7, 2011 Author Share Posted September 7, 2011 The error persist Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ibn/public_html/emailbomber/actions/sendemails.php on line 8 <?php session_start(); require_once('../includes/link.php'); $errmsg_arr = array(); $errflag = false; mail("$_SESSION['SESS_EMAIL']", "Teste - Enviar Emails", "Olá, ".$_SESSION['SESS_NAME']."\n\nTeste - Enviar Emails, From Teste"); $errmsg_arr[] = 'Os email serao enviados dentro de no maximo 48 horas.'; $errflag = true; $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: ../users/user/sendemails.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/246642-error-when-sending-email-with-a-_session-as-destinatary/#findComment-1266484 Share on other sites More sharing options...
adhbvklwqdbviabjiawdnbij Posted September 7, 2011 Author Share Posted September 7, 2011 Using just this <?php session_start(); require_once('../includes/link.php'); $errmsg_arr = array(); $errflag = false; echo "$_SESSION['SESS_EMAIL]"; ?> I got the same error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ibn/public_html/emailbomber/actions/sendemails.php on line 8 Quote Link to comment https://forums.phpfreaks.com/topic/246642-error-when-sending-email-with-a-_session-as-destinatary/#findComment-1266485 Share on other sites More sharing options...
premiso Posted September 7, 2011 Share Posted September 7, 2011 Look at the syntax highlighting in your post, this should fix it. echo "{$_SESSION['SESS_EMAIL']}"; If you are using associative indexed arrays inside of doube quotes, you need to bracket them for it to parse correctly. While we are on this topic, you do not need to surround the variable in quotes if it is not apart of anything but itself. So I would just do this, unless there is more than just that one echo statement: echo $_SESSION['SESS_EMAIL']; Quote Link to comment https://forums.phpfreaks.com/topic/246642-error-when-sending-email-with-a-_session-as-destinatary/#findComment-1266490 Share on other sites More sharing options...
adhbvklwqdbviabjiawdnbij Posted September 7, 2011 Author Share Posted September 7, 2011 I made some changes on the script. <?php require_once('../includes/link.php'); $query = "SELECT * FROM emails"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { mail("$row['email']", "Teste - Enviar Emails", "Teste - Enviar Emails", "From: Teste - Enviar Emails"); sleep(3); } ?> But is giving Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on mail("$row['email']", "Teste - Enviar Emails", "Teste - Enviar Emails", "From: Teste - Enviar Emails"); Quote Link to comment https://forums.phpfreaks.com/topic/246642-error-when-sending-email-with-a-_session-as-destinatary/#findComment-1266498 Share on other sites More sharing options...
premiso Posted September 7, 2011 Share Posted September 7, 2011 Why do I even bother replying if you are not going to read my post about associative indexed arrays and how to handle them? mail($row['email'], "Teste - Enviar Emails", "Teste - Enviar Emails", "From: Teste - Enviar Emails"); OR mail("{$row['email']}", "Teste - Enviar Emails", "Teste - Enviar Emails", "From: Teste - Enviar Emails"); For an explanation of WHY see my above post where I outlined how to fix your issue. And just incase you are too bold headed that you cannot scroll up, here is a link: http://www.phpfreaks.com/forums/index.php?topic=343361.msg1619881#msg1619881 Quote Link to comment https://forums.phpfreaks.com/topic/246642-error-when-sending-email-with-a-_session-as-destinatary/#findComment-1266516 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.