Jump to content

MAIL Help


Clinton

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/
Share on other sites

The script works, I've tested it from my local server.

 

Check what result do you get from $to = $row['email'];

 

Results:

 

  Quote

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:

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421492
Share on other sites

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...

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421493
Share on other sites

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>
Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421497
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421498
Share on other sites

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);
Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421500
Share on other sites

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 Brown
Contact E-mail: bob@brown.com
Contact 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 "

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421507
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421517
Share on other sites

  Quote

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

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421518
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421519
Share on other sites

  On 3/27/2013 at 10:26 PM, hunna03 said:

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?

Link to comment
https://forums.phpfreaks.com/topic/276235-mail-help/#findComment-1421523
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.