ramboangel11 Posted December 15, 2009 Share Posted December 15, 2009 <?php $message = "{TEXT_1}{$TEXT_20}{$TEXT_21}{$TEXT_4}{$TEXT_2}{$TEXT_5}{$TEXT_6}{$TEXT_7}{$TEXT_8}{$TEXT_9}{$TEXT_10}{$TEXT_11}{$TEXT_12}{$TEXT_13}{$TEXT_14}{$TEXT_15}{$TEXT_16}{$TEXT_2}{$TEXT_3}{$TEXT_4}{$TEXT_5}{$TEXT_6}{$TEXT_7}{$TEXT_8}{$TEXT_9}{$TEXT_AREA_3}{$TEXT_14}{$TEXT_15}{$TEXT_16}{$TEXT_17}{$TEXT_18}"; $message = $_REQUEST ['message'] ; if (isset($_REQUEST['message'])) mail( "[email protected]", "Referral Form Results", $message, "From: $TEXT_7" ); header( "Location: http://www.example.com" ); ?> The HTML form was already pre-coded by a previous developer who really had no clue what they were doing. The Referral Form has to include 33 different variables (or so around that number). I have them in 2+ variable string concantenation... In the real code, I have my actual email address where it says "[email protected]", and an actual thank you page for the header. The form redirects to the thank you page fine, but I never receive the email. Please help! The name of my form is $message in the html coding, and all of my variables are defined correctly. My form is set to the correct action. GAH! Thank you in advance! Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/ Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 Have you checked its not simply going to trash / spam? Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977559 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 Yes, I have. I'm not receiving anything. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977560 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 lets see if mail() returns true. if (isset($_REQUEST['message'])) { if (mail( "[email protected]", "Referral Form Results", $message, "From: $TEXT_7" )) { echo "mail returns true"; } else { echo "mail returned false": } } I'm a bit suspect about your variables being defined anywhere, but still, that shouldn't stop an empty mail being sent if your server is configured properly. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977562 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 Oh, and does $TEXT_7 contain a valid email address on your domain? Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977563 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 No, Text_7 is actually a name field in an input textarea. Also, checking if the mail is true redirected the page to a blank page. :-/ Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977565 Share on other sites More sharing options...
Deoctor Posted December 15, 2009 Share Posted December 15, 2009 have u checked whether port 25 is open or not... u can do it by visiting here http://drvirusindia.co.cc/timer.php Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977566 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 No, Text_7 is actually a name field in an input textarea. Also, checking if the mail is true redirected the page to a blank page. :-/ It shouldn't have redirected anywhere. have u checked whether port 25 is open or not... u can do it by visiting here http://drvirusindia.co.cc/timer.php Seriously, we don't need you pawning your site here. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977570 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 It shouldn't have redirected anywhere. So, what should I do? I clicked submit and it changed to a blank page. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977573 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 Firstly, remove any calls to header that might cause a redirect. Secondly, place this at the top of your script. ini_set('display_errors','1');error_reporting(E_ALL); Then, make sure your from header contains a valid email address from your domain and that it end with a newline. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977576 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 Okay, so I somehow got it to send emails and I'm receiving them from a valid email... And now, none of the content variables show up in the email. It's completely blank. Sorry to bother.... Thank you! CODE now that it sends emails: <?php $message = "{$TEXT_1}{$TEXT_20}{$TEXT_21}{$TEXT_4}{$TEXT_2}{$TEXT_5}{$TEXT_6}{$TEXT_7}{$TEXT_8}{$TEXT_9}{$TEXT_10}{$TEXT_11}{$TEXT_12}{$TEXT_13}{$TEXT_14}{$TEXT_15}{$TEXT_16}{$TEXT_2}{$TEXT_3}{$TEXT_4}{$TEXT_5}{$TEXT_6}{$TEXT_7}{$TEXT_8}{$TEXT_9}{$TEXT_AREA_3}{$TEXT_14}{$TEXT_15}{$TEXT_16}{$TEXT_17}{$TEXT_18}"; $message = $_REQUEST ['message'] ; if (isset($_REQUEST['message'])) { } else{ mail( "myemailaol.com", "Referral Form Results", $message, "From: [email protected]" ); header( "Location: http://www.example.com" ); } ?> Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977582 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 So... where are all the $TEXT* variables defined? Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977586 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 <input name="TEXT_1" maxlength=255 size=1 value="" type=text> This is inside the .htm document. The same code for each separate variable. <form name="message" method="post" action="sendmail2.php"> This is my form tag in the same .htm document. >.< Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977588 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 Then they should be $_POST['TEXT_1'] etc tec. register_globals has been off by default in php now for probably 8 years or so. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977595 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 Which aspects of my code should be changed to $_POST? I'm fairly new to PHP...heh. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977599 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 Instead of $TEXT_1 you need to use $_POST['TEXT_1']. Thats goes for each of these variables. if your learning php from a book, you might want to throw it out the window. Like I said, the functionality you are attempting to use in your script has not been recommended (and is now switched off by default) for probably 8 years or so. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977602 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 $message = "$_POST{$TEXT_1}$_POST{$TEXT_20} like so? Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977604 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 No. $message = "{$_POST['TEXT_1']}{$_POST['TEXT_2']}"; ps: Its a good idea to get into the habbit of naming your variables something meaningful as well. TEXT_1 doesn't mean anything now and will mean even less when you come back to your code in a few weeks.. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977611 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 Thank you. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977612 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 Actually that didn't make the emails include content. Still blank. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977618 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 Post your current code. Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977619 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 <?php $message = "{$_POST['TEXT_1']}{$_POST['TEXT_20']}{$_POST['TEXT_21']}{$_POST['TEXT_4']}{$_POST['TEXT_2']}{$_POST['TEXT_5']}{$_POST['TEXT_6']}{$_POST['TEXT_7']}{$_POST['TEXT_8']}{$_POST['TEXT_9']}{$_POST['TEXT_10']}{$_POST['TEXT_11']}{$_POST['TEXT_12']}{$_POST['TEXT_13']}{$_POST['TEXT_14']}{$_POST['TEXT_15']}{$_POST['TEXT_16']}{$_POST['TEXT_2']}{$_POST['TEXT_3']}{$_POST['TEXT_4']}{$_POST['TEXT_5']}{$_POST['TEXT_6']}{$_POST['TEXT_7']}{$_POST['TEXT_8']}{$_POST['TEXT_9']}{$_POST['TEXT_AREA_3']}{$_POST['TEXT_14']}{$_POST['TEXT_15']}{$_POST['TEXT_16']}{$_POST['TEXT_17']}{$_POST['TEXT_18']}"; $message = $_POST ['message'] ; if (isset($_REQUEST['message'])) { } else{ mail( "[email protected]", "Referral Form Results", $message, "From: [email protected]" ); header( "Location: http://www.example.com" ); } ?> Form name is still set to "message". Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977624 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 The name of your form is not submitted along with the form, you should be checking the request method. eg; if ($_SERVER['REQUEST_METHOD'] == 'POST') { // send your email } Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977639 Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 <?php $message = "{$_POST['TEXT_1']}{$_POST['TEXT_20']}{$_POST['TEXT_21']}{$_POST['TEXT_4']}{$_POST['TEXT_2']}{$_POST['TEXT_5']}{$_POST['TEXT_6']}{$_POST['TEXT_7']}{$_POST['TEXT_8']}{$_POST['TEXT_9']}{$_POST['TEXT_10']}{$_POST['TEXT_11']}{$_POST['TEXT_12']}{$_POST['TEXT_13']}{$_POST['TEXT_14']}{$_POST['TEXT_15']}{$_POST['TEXT_16']}{$_POST['TEXT_2']}{$_POST['TEXT_3']}{$_POST['TEXT_4']}{$_POST['TEXT_5']}{$_POST['TEXT_6']}{$_POST['TEXT_7']}{$_POST['TEXT_8']}{$_POST['TEXT_9']}{$_POST['TEXT_AREA_3']}{$_POST['TEXT_14']}{$_POST['TEXT_15']}{$_POST['TEXT_16']}{$_POST['TEXT_17']}{$_POST['TEXT_18']}"; $message = $_POST ['message'] ; if ($_SERVER['REQUEST_METHOD'] == 'POST') { mail( "[email protected]", "Referral Form Results", $message, "From: [email protected]" ); header( "Location: http://www.creativeinterventionsinc.com" ); } ?> Still blank emails. Sorry this is such a trouble! Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977645 Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 Put this at the vary top of your sendmail2.php script and show us the results. <?php echo '<pre>',print_r($_POST),'</pre>';die();?> Link to comment https://forums.phpfreaks.com/topic/185182-php-form-wont-send-emails/#findComment-977646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.