darkjedig Posted June 23, 2009 Share Posted June 23, 2009 Hi everyone I really need someones help here, I will be eternally grateful if I can get his problem solved. Basically, I have several of my clients websites hosted on streamline.net. I have a contact form on my clients site at http://www.ctsafetybarriers.co.uk/contact.html. However, the contact form will not send anything to my inbox although it says "message sent successfully". I know the form works, as I have tried it on my site, uploaded the whole ctsafety site to a subdomain on my account (with streamline also) and it works!. I have used FormToEmail.php, and this worked on my other accounts also but not on the ctsafety site. Below, is their reply as well as the code I made from their suggestions. (remember, I also used FormToEmail.php so if anyone knows a mod to make this work with streamline I will be ever grateful) BTW. They now say they can do nothing, as their test script (below) sends an email to my inbox. Why does this work and out of six contact forms I have tried, 0 have worked!!!!! > Test Script (works): <?php$res = mail("[email protected]", "Test php mailer for ctsafetybarriers.co.uk", "Hi,this message proves that php email scripts are working on the domain ctsafetybarriers.co.uk,Kind regards,StreamlineNet ", "From: [email protected]", "[email protected]"); if($res == 1){echo "email sent successfully, check email to make sure it was recieved."; } ?> Their Reply: Thank you for your query To prevent spam being sent through our webservers, there are certain conditions that must be met before our SMTP servers will send the email. 1) Email must be sent to, or from, an email address hosted by Streamline.net. An email address hosted by Streamline.net is not the same as a domain name hosted by Streamline.net. If your domain's MX record points to another email provider, it will not count as being hosted by Streamline.net. 2) To stop misuse of your form by third parties the sendmail_from variable should be set to your Streamline.net hosted email address. While access to the php.ini file is restricted on our shared environment, you can set this variable using the ini_set() command, shown below. 3) A fifth parameter -f should be added to the sendmail function. This will set the name of the from email address. In its basic form, a simple sendmail script will look like this: ini_set("sendmail_from", " [email protected] "); mail($email_to, $email_subject, $email_message, $headers, '[email protected]'); ?> Provided that you set the sendmail variable, before attempting to send the email. Specify the from address as a fifth parameter in the sendmail function, and the email is either to, or from, a Streamline.net hosted email address you should have no problems. My Script (this, and formtoemail.php do not work but respond as successfully sent) <?php /*\ The below (ini_set) is what they told me to put in to make it work, it was not in the script originally \*/ ini_set("sendmail_from", "[email protected]" ,"[email protected]"); $email_to = "[email protected]"; $name =$_POST['name']; $email_from =$_POST['email']; $email_subject = "Feedback from website"; $comments = $_POST['comments']; $headers = "From: $email_from .\n"; "Reply-To: $email_from .\n"; $message= "Name: ". $name . "\nComments: " . $comments; $sent = mail($email_to, $email_subject, $message, $headers, '-f .$email_from'); if ($sent) { header( "Location: http://www.ctsafetybarriers.co.uk/success.html" ); } else { echo 'There has been an error sending your comments. Please try later.'; } ?> Any help would be fantastic thankyou, Ryan[/] Quote Link to comment https://forums.phpfreaks.com/topic/163399-please-help-streamlinenet-hosted-site-no-contact-forms-working/ Share on other sites More sharing options...
darkjedig Posted June 23, 2009 Author Share Posted June 23, 2009 anybody please? Quote Link to comment https://forums.phpfreaks.com/topic/163399-please-help-streamlinenet-hosted-site-no-contact-forms-working/#findComment-862158 Share on other sites More sharing options...
mattal999 Posted June 23, 2009 Share Posted June 23, 2009 Try this: <?php /*\ The below (ini_set) is what they told me to put in to make it work, it was not in the script originally \*/ ini_set("sendmail_from", "[email protected]"); $email_to = "[email protected]"; $name =$_POST['name']; $email_from =$_POST['email']; $email_subject = "Feedback from website"; $comments = $_POST['comments']; $headers = "From: $email_from .\n"; "Reply-To: $email_from .\n"; $message= "Name: ". $name . "\nComments: " . $comments; $sent = mail($email_to, $email_subject, $message, $headers, '-f'.$email_from); if ($sent) { header( "Location: http://www.ctsafetybarriers.co.uk/success.html" ); } else { echo 'There has been an error sending your comments. Please try later.'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/163399-please-help-streamlinenet-hosted-site-no-contact-forms-working/#findComment-862174 Share on other sites More sharing options...
darkjedig Posted June 24, 2009 Author Share Posted June 24, 2009 Wow thanks it works! You have no idea how much heartache and trouble you've just saved me. I cannot believe that it actually works now, do you know what the problem was? My only issue now is to get this to work with the www.freecontactform.com script, as the other form is not too secure as I'm sure you know. Would I just add the (ini_set) function to this? Your help is greatly appreciated thanks again Quote Link to comment https://forums.phpfreaks.com/topic/163399-please-help-streamlinenet-hosted-site-no-contact-forms-working/#findComment-862516 Share on other sites More sharing options...
mattal999 Posted June 24, 2009 Share Posted June 24, 2009 I changed two lines, following the advice of your customer support friend: <?php // This ini_set("sendmail_from", "[email protected]" ,"[email protected]"); // To ini_set("sendmail_from", "[email protected]"); // The -f variable was not necessary. // And This $sent = mail($email_to, $email_subject, $message, $headers, '-f .$email_from'); // To $sent = mail($email_to, $email_subject, $message, $headers, '-f'.$email_from); // You just messed up the '.$variable includes, and there shouldn't have been a space between the -f and email address. ?> Hope this helps. Just so you know, I only had to follow the instructions that you were given to achieve this, and have no idea what the -f command does Quote Link to comment https://forums.phpfreaks.com/topic/163399-please-help-streamlinenet-hosted-site-no-contact-forms-working/#findComment-862670 Share on other sites More sharing options...
djjamiegee Posted July 23, 2009 Share Posted July 23, 2009 hi guys i now have the same problem and a very very stuck, still newish to php and just cant get any contact forms to send on streamline (will not use again) i have implmeted the code which you have said works but i cant get it to work on mine and i cant figure out why heres me code <?php ini_set("sendmail_from", "[email protected]"); $email_to = "[email protected]"; $name =$_POST['name']; $email_from =$_POST['email']; $phone =$_POST['phone']; $solution =$_POST['solution']; $budget =$_POST['budget']; $currentsite =$_POST['currentsite']; $comments = $_POST['comments']; $email_subject = "Contact Form"; $headers = "From: $email_from .\n"; "Reply-To: $email_from .\n"; $message= "Name: " . $name . "\nEmail: " . $email . "\nPhone: " . $phone ."\nSolution: " . $solution ."\nBudget: " . $budget ."\nCurrentSite: " . $currentsite ."\nComments: " . $comments; $sent = mail($email_to, $email_subject, $message, $headers, '-f'.$email_from); if ($sent) { header( "Location: http://www.designtwenty1.com" ); } else { echo 'There has been an error sending your comments. Please try later.'; } ?> many thanks and i hope someone can help, streamline shud be ashamed!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/163399-please-help-streamlinenet-hosted-site-no-contact-forms-working/#findComment-881163 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.