aeafisme23 Posted February 29, 2008 Share Posted February 29, 2008 Hello, i read http://www.phpfreaks.com/forums/index.php/topic,99582.0.html thread that was closes to my problem but having some minor issues that I am sure will make my hand go up to the forehead followed by a 'duh'. This is a php page that just has the form, on submit it goes to the next page and correctly posts the data on the next page but it will not email it for what ever reason. <form name="galatickets" method="GET" action="confirmation_2008.php" onSubmit="return checkgalatickets()"> <p class="bodyfont"> Name of Student #1: <input name="studentname1" size="45"></span></font> <br><br> Student's Class Name: <select size="1" name="classname1"> <option>Please Select a Class</option> <option value="class1">Mermaid 10:00 am Monday (Show 2)</option> <option value="class2">Cinderella 10:45 am Monday (Show 1)</option> <option value="class3">Sweet Peas 11:30 am Monday (Show1)</option> <option value="class4">Sprites 1:00 pm Monday (Show 1)</option> <option value="class5">Esmerelda 1:45 pm Monday (Show 2)</option> </select></span></font> <br><br> Which Show: <select size="1" name="show1"> <option>Please Select which Show</option> <option value="show1">Show 1 at 10:00 AM</option> <option value="show2">Show 2 at 2:00 PM</option> <option value="show3"> Show 3 at 7:00 PM</option> </select> <br><br> Studio Location: <select size="1" name="location1"> <option>Please Select a Studio Location</option> <option value="act1">Act I (Harbourtown Center)</option> <option value="act2">Act II (Hamilton County Sports Complex)</option> </select> this is how i mailed it. It's very important that the $message will email the variables from the form, any suggestions would be greatly appreciated! <?php $to = x@gmail.com'; $subject = 'Wakeup bob!'; $message = 'yo, whassup? $studentname1 and ticket total $tickets_total'; $headers = "From: x@gmail.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/93752-php-mail-from-form-to-email/ Share on other sites More sharing options...
ignace Posted February 29, 2008 Share Posted February 29, 2008 <?php $to = 'x@gmail.com'; $subject = 'Wakeup bob!'; $message = "yo, whassup? $studentname1 and ticket total $tickets_total"; // must be double quoted to be able to use variables inside a string $headers = "From: x@gmail.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> tested this code, it works for me Quote Link to comment https://forums.phpfreaks.com/topic/93752-php-mail-from-form-to-email/#findComment-480411 Share on other sites More sharing options...
aeafisme23 Posted February 29, 2008 Author Share Posted February 29, 2008 hehe i thought you said you tasted the code silly man! Thanks a bunch it works perfectly ! Quote Link to comment https://forums.phpfreaks.com/topic/93752-php-mail-from-form-to-email/#findComment-480414 Share on other sites More sharing options...
aeafisme23 Posted March 1, 2008 Author Share Posted March 1, 2008 Ok so yes this does work but i forgot to add a question in because apparently this script works on my dedicated server but the clients web hosting company is yahoo and im guessing that they don't allow this type of mailing in their php.ini (noticed alot of people talking about this). Do you know if this can still be done or where i should first check on the cpanel or .htaccess to see if i can change the settings to allow this script to work as it is intended? Thanks! EDIT: Restrictions Yahoo! places 2 restictions on the ability to send mail: A limited number of recipients may be sent mail each day You must specify a return address that is in your own domain They do this so we can't SPAM the world (at least not on the same day) and all the mail we send is traceable back to us. They don't count mail sent to addresses in our own domain so you can send copies to yourself without reducing the number of people to whom you can send mail each day. I guess this could be a problem, so i'm assuming that php/sending mail on yahoo web hosting is pretty much not worth it.... Quote Link to comment https://forums.phpfreaks.com/topic/93752-php-mail-from-form-to-email/#findComment-480555 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.