Jump to content
fazlionline

Php Email () Problem

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 Edited by fazlionline

Share this post


Link to post
Share on other sites

You're not actually calling mail()...

Share this post


Link to post
Share on other sites

Add this code to your script:

mail($to, $subject, $message, $headers);

Good Luck...

Edited by Vern Southern

Share this post


Link to post
Share on other sites

Yes, I know this code!But I want to add a field to my HTML file, where it can take “email” from the user, and when I check my inbox, there should be email form that “field email”.Thanks

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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']);

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...