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 = "[email protected]"; $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 . Link to comment https://forums.phpfreaks.com/topic/40260-sending-e-mail-via-form/ Share on other sites More sharing options...
realjumper Posted February 26, 2007 Share Posted February 26, 2007 I think... $to = "[email protected]"; should be $to = '[email protected]'; I might be wrong but that's how my mail form works Link to comment https://forums.phpfreaks.com/topic/40260-sending-e-mail-via-form/#findComment-194780 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? Link to comment https://forums.phpfreaks.com/topic/40260-sending-e-mail-via-form/#findComment-194781 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. Link to comment https://forums.phpfreaks.com/topic/40260-sending-e-mail-via-form/#findComment-194790 Share on other sites More sharing options...
SharkBait Posted February 27, 2007 Share Posted February 27, 2007 I think... $to = "[email protected]"; should be $to = '[email protected]'; 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! Link to comment https://forums.phpfreaks.com/topic/40260-sending-e-mail-via-form/#findComment-194880 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.