supa Posted July 30, 2006 Share Posted July 30, 2006 :-\Hi allIve read through the various FAQs on this subject here and elsewhere and managed to fix a few header errors etc but ive hit a dead end. I got my code here:[url=http://www.christian-web-masters.com/articles/web_php-mail-form-2.html]http://www.christian-web-masters.com/articles/web_php-mail-form-2.html[/url]its a simple code for sending form data. the page containing the form is " who.php " and the processing file is " process.php " which can be found here:[url=http://www.supasleuth.com/beats/who.php]www.supasleuth.com/beats/who.php[/url] and[url=http://www.supasleuth.com/beats/process.php]www.supasleuth.com/beats/process.php[/url]the problem is that although the return works fine i dont receieve the email with the data.im hopeful that the error would be obvious to more php-experienced eyes than mine. if anyone can take a moment to have a look i'll be grateful. (Im using dreamweaver six and notepad ).CheersMS Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/ Share on other sites More sharing options...
pixy Posted July 30, 2006 Share Posted July 30, 2006 Post the code you're using in process.php (we can't see it through a browser). Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-65680 Share on other sites More sharing options...
supa Posted July 30, 2006 Author Share Posted July 30, 2006 [quote author=pixy link=topic=102282.msg405697#msg405697 date=1154224489]Post the code you're using in process.php (we can't see it through a browser).[/quote]Sorry!! Here's the code[b]process.php[/b] :"<?php@extract($_POST);$email = stripslashes($email);mail('runamokg@yahoo.com',$subject,$text,"From: <$email>");header("location:who.php");?>"Taken from [b]who.php[/b] (file containing the form) :"Sign up for updates<form action="process.php" method="post">E-mail: <center><input type="text" name="email"><input type="submit" value="Send"></form>"Can anone spot a fault?Cheers Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-65692 Share on other sites More sharing options...
tomfmason Posted July 30, 2006 Share Posted July 30, 2006 There were several things wrong with that script. Here is one that I wrote for you. It uses rather simple mail headers but it should do the trick. Give it a try.[b]The new process.php[/b][code=php:0]<?php$email = $_POST['email']$email = stripslashes($email);//checks to make sure that an email address was enteredif (!$email) { echo "You did not enter an email address"; include("who.php"); exit;}/*Now this section is realy all a matter of personal perferenceI would personaly rather want to know what the email address meant.You can change the subject to anything that you want*/$to = "you@youremail.com";$subject = "You have received a request for updates";$message = "Hellow webmaster,A person at YourSite.com as requested updates. There email address is as follows.$email";/*This section here contains the mail information. You were trying to use the From as the users email address.*/mail($to, $subject, $message, "From: Update Request<you@yoursite.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");echo "Your request has been sent and we will reply shortly";include("who.php");?>[/code]Hope this helps,Tom Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-65700 Share on other sites More sharing options...
supa Posted July 30, 2006 Author Share Posted July 30, 2006 Hi Tommany thanks on this one.. your help is greatly appreciated..im on it right now il let peeps know how i get on!!CheersM Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-65945 Share on other sites More sharing options...
supa Posted July 30, 2006 Author Share Posted July 30, 2006 Im getting this error message:Parse error: parse error, unexpected T_VARIABLE in /home/groots/public_html/supasleuth/beats/process.php on line 3THis is how process.php is now<?php$email = $_POST['email']$email = stripslashes($email);if (!$email) { echo "You did not enter an email address"; include("who.php"); exit;}$to = "you@youremail.com";$subject = "You have received a request for updates";$message = "Hellow webmaster,A person at YourSite.com as requested updates. There email address is as follows.$email";mail($to, $subject, $message, "From: Update Request<you@yoursite.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");echo "Your request has been sent and we will reply shortly";include("who.php");?>Any ideas what might be up with this??Again cheers for the help!MS Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-65990 Share on other sites More sharing options...
redarrow Posted July 30, 2006 Share Posted July 30, 2006 try this ok.[code]<?php$email = ($_POST['email']);$email = stripslashes($email);if (!$email) { echo "You did not enter an email address"; include("who.php"); exit;}else{$to = "you@youremail.com";$subject = "You have received a request for updates";$message = "Hellow webmaster,A person at YourSite.com as requested updates. There email address is as follows.$email";mail($to, $subject, $message, "From: Update Request<you@yoursite.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");echo "Your request has been sent and we will reply shortly";include("who.php");}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-65991 Share on other sites More sharing options...
supa Posted July 30, 2006 Author Share Posted July 30, 2006 Cheers redarrow. that code [i]appears[/i] to work fine. the error and thank you messages work as and when needed. the only problem is im not getting the emails through :-[the only changes i made were to insert my email addy to line 9 :$to = "skivatron@aol.com";and line 14:mail($to, $subject, $message, "From: Update Request<skivatron@aol.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");I feel like im getting closer..cheers for all the help!!! Can anyone see what might be wrong?MS Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-66028 Share on other sites More sharing options...
redarrow Posted July 30, 2006 Share Posted July 30, 2006 There you go mate fully done just add your email address ok.this should work and if so you need to keep hold off what works for you i strongly advise you to backup a copy if it works.good luck ok.[code]<?php$email = ($_POST['email']);$email = stripslashes($email);if (!$email) {echo "You did not enter an email address";include("who.php");exit;}else{$to = 'nobody@example.com';$subject = 'You have received a request for updates';$message = 'Hellow webmaster,A person at YourSite.com as requested updates. There email address is as follows.$email';$headers = 'From: webmaster@example.com' . "\r\n" .'Reply-To: webmaster@example.com' . "\r\n" .'X-Mailer: PHP/' . phpversion();mail($to, $subject, $message, $headers);echo 'Your request has been sent and we will reply shortly';include("who.php");}?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-66066 Share on other sites More sharing options...
supa Posted July 30, 2006 Author Share Posted July 30, 2006 Daym still not working.Worse the validity check doesn't work now. No - the validity check does work (modification to post).Thanks for your patience mate. I dont have a clue what's up. ??? Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-66094 Share on other sites More sharing options...
supa Posted July 30, 2006 Author Share Posted July 30, 2006 can ne1 help??Cheers Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-66141 Share on other sites More sharing options...
pixy Posted July 30, 2006 Share Posted July 30, 2006 What error are you getting? Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-66150 Share on other sites More sharing options...
supa Posted July 31, 2006 Author Share Posted July 31, 2006 Thers no error im just not getting the mail through. Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-66169 Share on other sites More sharing options...
pixy Posted July 31, 2006 Share Posted July 31, 2006 PHP has no way of reporting that the mail was sent, it just tells the mailserver to send a message. I'd say just double check your variables and such. Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-66425 Share on other sites More sharing options...
Ifa Posted July 31, 2006 Share Posted July 31, 2006 There also a possibility that a spam filter etc is blocking it... Quote Link to comment https://forums.phpfreaks.com/topic/15983-sending-form-data-through-email/#findComment-66430 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.