mail script

A

Anonymous

Guest
sup... i have created a (well tryed to creat) a script.. that sends an email to the user that you type in the email addr to.. but its not working.... does anyone knows why.... here is the code..


Code:
<?php

if($submit){
   echo "(Emails has been sent to users)";
}else{
?>

<FORM METHOD="post" ACTION="<?php echo $PHP_SELF?>">
Your Email:<br>
<INPUT TYPE="text" NAME="yemail"><br>
 EMAILS:<br>
<INPUT TYPE="text" NAME="email"><br>
 Message:<br>
<TEXTAREA NAME="message"></TEXTAREA><br>
<INPUT TYPE="submit" NAME="submit" VALUE="Send Emails">
<?php
mail( $email, "Testing emails", $message, "FROM: $yemail" );
}
?>

See what it does is .. it shows me the echo "(Emails has been sent to users)" but then i check my email.. to see if it got there.. cause i test it out on my self first.. well anyways.. i never the the email...[/code]
 
Code:
<?php 

if($submit){ 
   if(mail( $email, "Testing emails", $message, "FROM: $yemail" )) {echo "(Emails has been sent to users)"; 
} 
}else{ 
echo "
<FORM METHOD=post ACTION=$PHP_SELF> 
Your Email:<br> 
<INPUT TYPE=text NAME=yemail><br> 
EMAILS:<br> 
<INPUT TYPE=text NAME=email><br> 
Message:<br> 
<TEXTAREA NAME=message></TEXTAREA><br> 
<INPUT TYPE=submit NAME=submit VALUE='Send Emails'>";
}
?>
 
thank you.. can you please explain to me why it wasnt working.. at first.. i see that you have added the if statement
 
Code:
<?php 
mail( $email, "Testing emails", $message, "FROM: $yemail" ); 
} 
?>

this code working in any condition...

but what $submit has a value mail is going to email adress... if not genetated a mail form...

simple the best!
 
Back
Top