Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

mail script

the mail() function

Moderators: macek, egami, gesf

mail script

Postby xlordt » Thu Dec 12, 2002 9:11 pm

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

<?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]
User avatar
xlordt
New php-forum User
New php-forum User
 
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ

Postby Oleg Butuzov » Fri Dec 13, 2002 3:39 am

Code: Select all
<?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'>";
}
?>
 
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby xlordt » Fri Dec 13, 2002 8:43 am

thank you.. can you please explain to me why it wasnt working.. at first.. i see that you have added the if statement
User avatar
xlordt
New php-forum User
New php-forum User
 
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ

Postby Oleg Butuzov » Mon Dec 16, 2002 5:07 am

Code: Select all
<?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!
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.