April 4, 200917 yr Hi all , I happen to be hosted with streamline.net and i am having trouble setting up there email scripts with php.. Maybe its me as im new with php but i cant seem to get this code to work and send emails myemail is not this email in script i have changed this just added it for this forum. <?php if(isset($_POST['submit'])) { $to = "myemail"; $subject = "Website Email"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message\n"; echo "Data has been submitted to $to!"; ini_set("sendmail_from", "myemail"); mail($to, $subject, $body); } else { echo "Failed!"; } ?> html code <form method="POST" action="mailer.php"> <div id="e_name">Name: <input type="text" id="name" /></div> <div id="e_email">Email: <input type="text" id="email" /></div> <div id="e_mes">Message: <textarea name="message" id="message"></textarea></div> <div id="e_but"><input type="submit" value="Submit" id="submit" /></div> </form> Edited January 28, 201016 yr by Sam G added [code] tags
April 4, 200917 yr Hi Do you know if you are on a windows or linux server. Also try putting this line ini_set("sendmail_from", "myemail"); At the beginning after your opening <?php tag Is it giving you any error messages. Pat Edited January 28, 201016 yr by Sam G added [code] tags
April 4, 200917 yr Author Windows server and yes im getting the failed echo .. il try it at top but im sure i did this all ready.
April 4, 200917 yr Try changing <input type="submit" value="Submit" id="submit" /> to <input type="submit" value="submit" id="submit" />
April 5, 200917 yr Hi - you are missing a variable at the end that Streamline requires - here's some code from one of my mail forms that works on streamline: mail("jo@test.co.uk", "Website Enquiry", "Name: $name\nPhone No: $phoneno\nMessage: $message\n", "From: $_REQUEST[email]", [b]"-fjo@test.co.uk[/b]")) You need to add in the "-fjo@test.co.uk" part - obviously change to your email (this email must already be set up on the your streamline URL or it won't work - so if you haven't set up an email account yet - do this first). Also you need something like this at the beginning of our php file: ini_set('sendmail_from', 'jo@test.co.uk'); Hope this helps - if not PM me and I'll send you my complete code. Jo Edited January 28, 201016 yr by Sam G added [code] tags
April 6, 200917 yr Hi - you are missing a variable at the end that Streamline requires - here's some code from one of my mail forms that works on streamline: mail("jo@test.co.uk", "Website Enquiry", "Name: $name\nPhone No: $phoneno\nMessage: $message\n", "From: $_REQUEST[email]", [b]"-fjo@test.co.uk[/b]")) You need to add in the "-fjo@test.co.uk" part - obviously change to your email (this email must already be set up on the your streamline URL or it won't work - so if you haven't set up an email account yet - do this first). Also you need something like this at the beginning of our php file: ini_set('sendmail_from', 'jo@test.co.uk'); Hope this helps - if not PM me and I'll send you my complete code. Jo +1 Edited January 28, 201016 yr by Sam G added [code] tags
April 7, 200917 yr you will need to have the -f parameter but you also have to have a email going from or to a streamline domain. They do this to stop mass spamming. If you are on their linux server you ownt need the ini_set("sendmail_from", "myemail"); string from what i remember. Thats for windows servers only, but obviously you wont be able to use PHP on that since apache is on the linux server they providce. If you search their help section there is a write up there for the correct way to enter the PHP part. If you cant find this let me know and i will try and track it down.
Create an account or sign in to comment