lszanto Posted October 6, 2007 Share Posted October 6, 2007 I am working on a site and for some reason the mail function keeps returning false for no reason when all the input is correct and should be sending, the script is below. <?php //If form submitted. if(isset($_POST['name']) && isset($_POST['url']) && empty($_POST['agree'])) { //Get/set vars. $name = $_POST['name']; $url = $_POST['url']; $perms = $_POST['perms']; $subject = "Pleasing Page Submission"; $to = "luke@lszanto.hosttds.com"; $from = "From: <Pleasing Pages>"; //Check for perms. if($perms == "on") { $perms = "You have owners permission."; } else { $perms = "You need to contact the owner and get permission."; } //Make email. $message = "You have recieved a page that has pleased $name\n\nName: $name\nPleasing Page: $url\nPermission: $perms\n\nThanks, Pleasing Pages"; //Make mail var. $mail = mail($subject, $to, $message, $from); //Check if sent. if($mail) { //Sent. echo "$url has been sucessfully submitted."; } else { //Didn't send. echo "An error has occured, please go <a href=\"http://lszanto.hosttds.com/wordpress/please-us/\" >back</a> and try again."; } } else { echo "<script> window.location = 'http://lszanto.hosttds.com'; </script><noscript><meta http-equiv=\"refresh\" content=\"0;url=http://lszanto.hosttds.com\" /></noscript>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/ Share on other sites More sharing options...
lszanto Posted October 6, 2007 Author Share Posted October 6, 2007 Bump, Does nobody know what the problem is? Quote Link to comment https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/#findComment-363137 Share on other sites More sharing options...
teng84 Posted October 6, 2007 Share Posted October 6, 2007 does it send mail? Quote Link to comment https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/#findComment-363138 Share on other sites More sharing options...
lszanto Posted October 6, 2007 Author Share Posted October 6, 2007 No it displays 'An error has occured, please go <a href=\"http://lszanto.hosttds.com/wordpress/please-us/\" >back</a> and try again.' which is the result of an error in the mail query. Quote Link to comment https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/#findComment-363139 Share on other sites More sharing options...
teng84 Posted October 6, 2007 Share Posted October 6, 2007 $to = "youreamil here";//put your email here<-------------------------- $subject = "TENG"; $txt = "Hello world!"; $headers = "From: teng84@yahoo.com"; mail($to,$subject,$txt,$headers); try, that works fine Quote Link to comment https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/#findComment-363141 Share on other sites More sharing options...
darkfreaks Posted October 6, 2007 Share Posted October 6, 2007 <?php if ($mail=="true") { echo "message sent"; } else if ($mail=="false") { echo "please go back"; }?> Quote Link to comment https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/#findComment-363142 Share on other sites More sharing options...
lszanto Posted October 6, 2007 Author Share Posted October 6, 2007 Thanks so much, I was dumb and got the $to and $subject mixed around. Quote Link to comment https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/#findComment-363146 Share on other sites More sharing options...
teng84 Posted October 6, 2007 Share Posted October 6, 2007 yeah i saw that but i want you to figure whats your mistake lol Quote Link to comment https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/#findComment-363148 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.