Jump to content

Php Email () Problem


fazlionline

Recommended Posts

Dear allI have created two pages, the first one is HTML Form and the second one is PHP ScriptMy html file name is email01.html, and its code is:

<html><link href="school.css" rel="stylesheet" type="text/css"><body><table width="400" border="0" align="center" cellpadding="3" cellspacing="3"> <tr> <td><form id="form1" name="form1" method="post" action="email01.php"> <table width="400" border="1" cellpadding="7" cellspacing="3" bordercolor="#990000"> <tr> <td colspan="2" bgcolor="#FF9900"><h1>Send us your feed back:</h1></td> </tr> <tr> <td valign="top">Name:</td> <td><label> <input type="text" name="urname" id="urname" /> </label></td> </tr> <tr> <td valign="top">Email:</td> <td><label> <input type="text" name="uremail" id="uremail"> </label></td> </tr> <tr> <td valign="top">Message:</td> <td><label> <textarea name="urmessage" id="urmessage" cols="45" rows="5"></textarea> </label></td> </tr> <tr> <td colspan="2" align="center" valign="top"><label> <input type="submit" name="button" id="button" value="Send Your Message" /> </label></td> </tr> </table> </form> </td> </tr></table></body></html>
And my PHP page name is email01.php, and its code is:
<?php$email=$_POST['email'];$to = '123@mail.com';$subject = $_POST['urname'];$message = $_POST['urmessage'];$headers = "From: $uremail" . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();echo "thanks, your message is sent!";?>
When I press the send button, I get the message:
thanks, your message is sent!
But when I check my inbox, there is no any email!Need helpFazlionline
Link to comment
Share on other sites

??? You still need to send the mail eventually...

Link to comment
Share on other sites

You forgot to add

$uremail = $_POST['uremail'];

For security, I'd get rid of any \n and \r so that people can't use the headers to abuse your E-mail form:

$uremail = preg_replace("/[\n\r]/", "", $_POST['uremail']);

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...