Clinton Posted March 27, 2013 Share Posted March 27, 2013 If I put this piece of code anywhere in my script it does NOT send out the mail but it DOES say that it was successful. I can't figure it out. <p><font color='red' size='2'>You are receiving this message because you have previously signed up to do so. If you would no longer like to be an exercise participant volunteer, click <a href='http://www.blah.com/participate/yes.php?id=" . $id . "&email=" . $to . "'> here</a> to remove yourself.</font></p> Here's the entire code: <? if (isset($_POST['Submit'])){ $sfname = $_POST["fname"]; $slname = $_POST["lname"]; $cname = $sfname . " " . $slname; $email = $_POST["email"]; $tele = $_POST["tele"]; $info = $_POST["editor1"]; if ($pword == $pword2){ $sql="SELECT * FROM participants2"; $result=mysql_query($sql); while($row = mysql_fetch_array($result)) { $id = $row['id']; $to = $row['email']; $fname = $row['pfname']; $message = "Hello " . $fname . ", <p> Below is a request for volunteer exercise participants. Follow the instructions accordingly, as they will all differ. Please direct any questions you have to the contact listed below.</p> <center> <p><font color='green'><b>If you volunteer for this event, PLEASE inform the Contact listed below that you heard about this opportunity through the Participant Database!!!</b></font></p> </center> <p>------------------- MESSAGE FOLLOWS --------------------</p> <p><b> Contact Name: </b>" . $cname . " <br><b> Contact E-mail: </b>" . $email . " <br><b> Contact Telephone: </b>" . $tele . " </p> <p>" . $info . "</p>"; $subject = "Call for Participants - EXERCISE REQUEST"; $headers = 'From: '. $cname .' <'. $email .'>' . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $response = mail($to,$subject,$message,$headers); if($response) {echo "Your Message Has Been Sent!<br>";} else {echo "Oh No, you screwed it up!";} }} else { ?> You have entered an incorrect password. Go back and try again. <? }} else { ?> There was an error processing this page. Error Code: 347 - Does Not Exist <? } ?> Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/ Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 Well, I cannot see the value of the $to variable. Where is it? Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421489 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 It's there. $to = $row['email']; Again, it works without that line I mentioned earlier. It's just when I put it in does it not want to work. It makes no sense to me. CJA Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421490 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 (edited) The script works, I've tested it from my local server. Check what result do you get from $to = $row['email']; Results: Hello , Below is a request for volunteer exercise participants. Follow the instructions accordingly, as they will all differ. Please direct any questions you have to the contact listed below. If you volunteer for this event, PLEASE inform the Contact listed below that you heard about this opportunity through the Participant Database!!! ------------------- MESSAGE FOLLOWS -------------------- Contact Name: Contact E-mail: Contact Telephone: Edited March 27, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421492 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 That "entire code" does not include <p><font color='red' size='2'>You are receiving this message because you have previously signed up to do so. If you would no longer like to be an exercise participant volunteer, click <a href='http://www.blah.com/participate/yes.php?id=" . $id . "&email=" . $to . "'> here</a> to remove yourself.</font></p> Did you include that somewhere in the script, for instance after <p>" . $info . "</p>"; before you tried it out? Here... let me post the entire code WITH that line in there. <? if (isset($_POST['Submit'])){ $sfname = $_POST["fname"]; $slname = $_POST["lname"]; $cname = $sfname . " " . $slname; $email = $_POST["email"]; $tele = $_POST["tele"]; $info = $_POST["editor1"]; if ($pword == $pword2){ $sql="SELECT * FROM participants2"; $result=mysql_query($sql); while($row = mysql_fetch_array($result)) { $id = $row['id']; $to = $row['email']; $fname = $row['pfname']; $message = "Hello " . $fname . ", <p> Below is a request for volunteer exercise participants. Follow the instructions accordingly, as they will all differ. Please direct any questions you have to the contact listed below.</p> <center> <p><font color='green'><b>If you volunteer for this event, PLEASE inform the Contact listed below that you heard about this opportunity through the Participant Database!!!</b></font></p> </center> <p>------------------- MESSAGE FOLLOWS --------------------</p> <p><b> Contact Name: </b>" . $cname . " <br><b> Contact E-mail: </b>" . $email . " <br><b> Contact Telephone: </b>" . $tele . " </p> <p>" . $info . "</p> <p><font color='red' size='2'>You are receiving this message because you have previously signed up to do so. If you would no longer like to be an exercise participant volunteer, click <a href='http://www.blah.com/participate/yes.php?id=" . $id . "&email=" . $to . "'> here</a> to remove yourself.</font></p>"; $subject = "Call for Participants - EXERCISE REQUEST"; $headers = 'From: '. $cname .' <'. $email .'>' . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $response = mail($to,$subject,$message,$headers); if($response) {echo "Your Message Has Been Sent!<br>";} else {echo "Oh No, you screwed it up!";} }} else { ?> You have entered an incorrect password. Go back and try again. <? }} else { ?> There was an error processing this page. Error Code: 347 - Does Not Exist <? } ?> Give that a shot... Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421493 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 Hm..... can you explain us what is that? <p><font color='red' size='2'>You are receiving this message because you have previously signed up to do so. If you would no longer like to be an exercise participant volunteer, click <a href='http://www.blah.com/participate/yes.php?id=" . $id . "&email=" . $to . "'> here</a> to remove yourself.</font></p> Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421497 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 It's just a link that pulls in variables to identify a user so that a user can click the link and remove themselves from a list. I verified that the link does populate appropriately and, when not in the "Mail" context it outputs in PHP just fine. I've gone over the code 100 times. Can't figure out why it works but doesn't work when I drop it in here. Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421498 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 I even tried appending to the $message variable ( $message .= ) but that didn't work either. Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421499 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 Ok, between $headers and $response put the line below, submit the form and give me the result back, $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; echo var_dump($to, $subject,$message,$headers); exit; $response = mail('dtuparov@gmail.com',$subject,$message,$headers); Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421500 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 Well, this is the output... I'm not sure anything was sent... string(18) "CJA@blah.org" string(40) "Call for Participants - EXERCISE REQUEST" string(986) "Hello Blah, Below is a request for volunteer exercise participants. Follow the instructions accordingly, as they will all differ. Please direct any questions you have to the contact listed below. If you volunteer for this event, PLEASE inform the Contact listed below that you heard about this opportunity through the Participant Database!!! ------------------- MESSAGE FOLLOWS -------------------- Contact Name: Bobby BrownContact E-mail: bob@brown.comContact Telephone: 555-555-5555 You are receiving this message because you have previously signed up to do so. If you would no longer like to be an exercise participant volunteer, click here to remove yourself. " string(99) "From: Bobby Brown MIME-Version: 1.0 Content-Type: text/html; charset=ISO-8859-1 " Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421507 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 Everything is just fine. Are you trying to send that message from a local server or a remote one? Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421511 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 Remote Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421512 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 Ok, I am going to send you the same message from my remote server to this e-mail: CJA@blah.org. Give me few minutes. Is it a real email address? Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421513 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 Sounds good, thanks. Send it to hunna03@gmail.com Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421514 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 Done, I sent it from my local server..... check in the spam folder. Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421516 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 (edited) Yup, all I got was: Hello , Below is a request for volunteer exercise participants. Follow the instructions accordingly, as they will all differ. Please direct any questions you have to the contact listed below. If you volunteer for this event, PLEASE inform the Contact listed below that you heard about this opportunity through the Participant Database!!! ------------------- MESSAGE FOLLOWS -------------------- Contact Name: Contact E-mail: Contact Telephone: I didn't get that "click here to remove" link Edited March 27, 2013 by hunna03 Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421517 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 (edited) I didn't get that "click here to remove" link I used only this part of the script: $message = "Hello " . $fname . ", <p> Below is a request for volunteer exercise participants. Follow the instructions accordingly, as they will all differ. Please direct any questions you have to the contact listed below.</p> <center> <p><font color='green'><b>If you volunteer for this event, PLEASE inform the Contact listed below that you heard about this opportunity through the Participant Database!!!</b></font></p> </center> <p>------------------- MESSAGE FOLLOWS --------------------</p> <p><b> Contact Name: </b>" . $cname . " <br><b> Contact E-mail: </b>" . $email . " <br><b> Contact Telephone: </b>" . $tele . " </p> <p>" . $info . "</p>"; $subject = "Call for Participants - EXERCISE REQUEST"; $headers = 'From: '. $cname .' <'. $email .'>' . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $response = mail('hunna03@gmail.com',$subject,$message,$headers); if($response) {echo "Your Message Has Been Sent!<br>";} As I said before, the mail script works just fine, you have to check what's going on before this part of the script. PS. If you want to check everything just post the html form Edited March 27, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421518 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 Yeah, it's got something to do with: <p><font color='red' size='2'>You are receiving this message because you have previously signed up to do so. If you would no longer like to be an exercise participant volunteer, click <a href='http://www.blah.com/participate/yes.php?id=" . $id . "&email=" . $to . "'> here</a> to remove yourself.</font></p>"; That I have to figure out. Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421519 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 (edited) Yeah, it's got something to do with: <p><font color='red' size='2'>You are receiving this message because you have previously signed up to do so. If you would no longer like to be an exercise participant volunteer, click <a href='http://www.blah.com/participate/yes.php?id=" . $id . "&email=" . $to . "'> here</a> to remove yourself.</font></p>"; That I have to figure out. No, according to the log that you provided me above the problem is not there. Have you ever sent the message from this particular web hosting? Why this string is 18 characters long string(18) "CJA@blah.org"? Did you try to replace that e-mail address? Edited March 27, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421523 Share on other sites More sharing options...
Clinton Posted March 27, 2013 Author Share Posted March 27, 2013 Yes, you just sent it to me and it worked! I think I have an idea... Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421524 Share on other sites More sharing options...
jazzman1 Posted March 27, 2013 Share Posted March 27, 2013 Yes, you just sent it to me and it worked! I think I have an idea... Yep, post the html form the problem is inside the input email field. Quote Link to comment https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421525 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.