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

 

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 by jazzman1
Link to comment
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
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
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
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
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
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

Edited by hunna03
Link to comment
Share on other sites

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 by jazzman1
Link to comment
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
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.

 

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 by jazzman1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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