Othmo Posted February 26, 2007 Share Posted February 26, 2007 Hello, I just started to learn php, and now I'm trying to create simple e-mail sender. HTML file is here: <html> <head> <style> </style> </head> <body> <form method="post" action="post.php"> Subject:<br /> <input type="text" name="subject" /><br /> E-mail:<br /> <input type="text" name="email" /><br /><br /> Comments:<br /> <textarea cols="30" rows="10" name="message"> </textarea><br /> <input type="submit" value="Send" /> <input type="reset" value="Clear" /> </form> </body> </html> and PHP file (post.php) is here <?php $to = "mymail@gmail.com"; $subject = $_POST['subject']; $email = $_POST['email']; $message= $_POST['message']; $headers = "From: $email"; $sent = mail($to, $subject, $email, $message, $headers); if($sent) { echo "E-mail was succesfully sent"; } else { echo "Problem encountered when sending e-mail"; } ?> That just doesn't seem working, so could ya php gurus tell me if there's something wrong. Thnx . Quote Link to comment Share on other sites More sharing options...
realjumper Posted February 26, 2007 Share Posted February 26, 2007 I think... $to = "mymail@gmail.com"; should be $to = 'mymail@gmail.com'; I might be wrong but that's how my mail form works Quote Link to comment Share on other sites More sharing options...
SharkBait Posted February 26, 2007 Share Posted February 26, 2007 How does it not seem to be working? Does it give you an error message at all? Quote Link to comment Share on other sites More sharing options...
Othmo Posted February 26, 2007 Author Share Posted February 26, 2007 I used this form to try sending message to my e-mail, but the e-mail didn't arrive. But now it seems to have arrived, there was just a long delay, sorry for this topic and thanks for your answers. Quote Link to comment Share on other sites More sharing options...
SharkBait Posted February 27, 2007 Share Posted February 27, 2007 I think... $to = "mymail@gmail.com"; should be $to = 'mymail@gmail.com'; I might be wrong but that's how my mail form works Those two things are the same..well they work out to be the same anyway, they can be used differently though! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.