scgoralski Posted December 17, 2008 Share Posted December 17, 2008 Hi, I'm currently writting a web enquiry form, but i'm having issues with the amount of data i'm trying to push to a PHP emailing script. wont email anything. It's quite strange. The script and the HTML page work when i enter very minimal data, but when i fill out all the fields, it looks like it's all working fine, yet no email is sent. Has anyone had any experience with this at all? Here's the PHP emailing script: <?php // Setup smtp server global vars ini_set('smtp_port','25'); ini_set('SMTP','xxx.xxx.xxx.xxx'); ini_set('username','xxxx@xxxx.xxx.xxx'); ini_set('password','xxxxxxxx'); ini_set('sendmail_from','xxxxx@xxxx.xxxx.xxx'); // Assign the POST variables from the HTML to local variables for the script $sender_ip = $_SERVER['REMOTE_ADDR']; $sender_firstname = $_POST["firstname"]; $sender_surname = $_POST["surname"]; $sender_phone = $_POST["phone"]; $sender_email = $_POST["email"]; $sender_address = $_POST["address"]; $child1_name = $_POST["child1_name"]; $child1_entry = $_POST["child1_entry"]; $child1_grade = $_POST["child1_grade"]; $child2_name = $_POST["child2_name"]; $child2_entry = $_POST["child2_entry"]; $child2_grade = $_POST["child2_grade"]; $child3_name = $_POST["child3_name"]; $child3_entry = $_POST["child3_entry"]; $child3_grade = $_POST["child3_grade"]; $child4_name = $_POST["child4_name"]; $child4_entry = $_POST["child4_entry"]; $child4_grade = $_POST["child4_grade"]; $child5_name = $_POST["child5_name"]; $child5_entry = $_POST["child5_entry"]; $child5_grade = $_POST["child5_grade"]; $message = $_POST["message"]; // A few line spaces here and there :-) echo "\n\n"; // Compile these details to form the body of the email $msg = "Query came from IP Address: $sender_ip\n\n"; $msg .= "Name: $sender_firstname "; $msg .= "$sender_surname\n"; $msg .= "E-Mail: $sender_email\n"; $msg .= "Phone: $sender_phone\n\n"; $msg .= "Address:\n--------\n"; $msg .= "$sender_address\n\n"; $msg .= "Children's Details:\n-------------------\n"; $msg .= "CHILD 1: $child1_name\t\tENTRY YEAR: $child1_entry\t\tGRADE: $child1_grade\n"; $msg .= "CHILD 2: $child2_name\t\tENTRY YEAR: $child2_entry\t\tGRADE: $child2_grade\n"; $msg .= "CHILD 3: $child3_name\t\tENTRY YEAR: $child3_entry\t\tGRADE: $child3_grade\n"; $msg .= "CHILD 4: $child4_name\t\tENTRY YEAR: $child4_entry\t\tGRADE: $child4_grade\n"; $msg .= "CHILD 5: $child5_name\t\tENTRY YEAR: $child5_entry\t\tGRADE: $child5_grade\n\n\n"; $msg .= "Special Notes:\n--------------\n$message\n\n\n"; // Hardcode the recipient and the subject title $recipient = "xxxx@xxxxxx.xxx.xx"; $subject = "Website Enquiry"; // Setup mail headers $mailheaders = "From: xxxx@xxx.xxx.xx"; $mailheaders .= "Reply-To: $sender_email\r\nReply-To: $sender_email\r\nReturn-Path: $sender_email"; //Send the email mail($recipient, $subject, $msg, $mailheaders); // Change the details in the title bar and display a confirmation msg echo "<HTML><HEAD><TITLE>Some College ---- Email Sent.</TITLE></HEAD></HTML>"; echo "<br>"; echo "<H1 align=center>Thank You.</H1>"; echo "<P align=center>We appreciate your time, your request has been sent. You should receive an<br>email with the 2009 parent student prospectus attached.</P>"; header( 'Location: http://web/query/done.html' ) ; ?> Can anyone suggest a better way to collect a LOT of data from one page? Would i be better off splitting the form into two pages, and then maybe dumping the info into a DB and at the end read the db back into variables and email from there?? Please help! Quote Link to comment https://forums.phpfreaks.com/topic/137300-too-much-data-for-post-to-a-php-script/ Share on other sites More sharing options...
premiso Posted December 17, 2008 Share Posted December 17, 2008 Ummm, try printing the fields to the page and see if they all print. POST should handle everything just fine as long as the text totals under 2MBs. Chances are it is something in the email that cuts it off. But I would test it by printing the variables to the screen to make sure. Quote Link to comment https://forums.phpfreaks.com/topic/137300-too-much-data-for-post-to-a-php-script/#findComment-717371 Share on other sites More sharing options...
scgoralski Posted December 17, 2008 Author Share Posted December 17, 2008 Hi premiso, Cheers for that. I'll have a look . . Quote Link to comment https://forums.phpfreaks.com/topic/137300-too-much-data-for-post-to-a-php-script/#findComment-717377 Share on other sites More sharing options...
scgoralski Posted December 17, 2008 Author Share Posted December 17, 2008 Hmmm.... Ok..well, all my data was displayed to screen on the send email script, so the POST side of things isn't actually the problem... I can rule that one out now. So... the issue seems to be that as my $msg variable grows in length, the script doesn't seem to want to email it... Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/137300-too-much-data-for-post-to-a-php-script/#findComment-717396 Share on other sites More sharing options...
premiso Posted December 17, 2008 Share Posted December 17, 2008 Look into the PHPMailer script. The mail function and smtp can do some funky things from what I remember when I tried using SMTP with it. Quote Link to comment https://forums.phpfreaks.com/topic/137300-too-much-data-for-post-to-a-php-script/#findComment-717397 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.