nick_whitmarsh Posted March 5, 2007 Share Posted March 5, 2007 Hi all, I am trying to write a simple feebback form. It all appears to work apart from it does not send an email. <?php $username = $_POST['username']; $useraddr = $_POST['useraddr']; $comments = $_POST['comments']; $to = "[email protected]"; $re = "Website Feedback"; $msg = $comments; mail( $to, $re, $msg ); ?> <html> <head><title>Message Received</title></head> <body> <h3>Thanks for your comments</h3> Message received from <?php echo ( $username ); ?> <br /> Reply to <?php echo( $useraddr ); ?> </body> </html> ; For Win32 only. SMTP = [email protected] smtp_port = 25 ; For Win32 only. sendmail_from = [email protected] I have also put my php.ini code, could anyone please help me. Nick Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/ Share on other sites More sharing options...
Orio Posted March 5, 2007 Share Posted March 5, 2007 <?php if(!mail( $to, $re, $msg )) echo "PHP problem"; else echo "Problem with your spam filter probably..."; ?> What does it echo? Orio. Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199716 Share on other sites More sharing options...
nick_whitmarsh Posted March 5, 2007 Author Share Posted March 5, 2007 It gives me a php problem!! Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199718 Share on other sites More sharing options...
Orio Posted March 5, 2007 Share Posted March 5, 2007 I don't know much about how do you configure the mail() function, but let's try something else before- adding a from header: <?php if(!mail( $to, $re, $msg, "From: [email protected]" )) echo "PHP problem"; else echo "Problem with your spam filter probably..."; ?> Is it still giving you "PHP problem"? Orio. Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199721 Share on other sites More sharing options...
nick_whitmarsh Posted March 5, 2007 Author Share Posted March 5, 2007 Yeah it still gives me the annoying php problem, and still hasnt sent the email. Nick Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199725 Share on other sites More sharing options...
Orio Posted March 5, 2007 Share Posted March 5, 2007 As I said, I don't know much from here on. Maybe wait for someone else... Sorry Orio. Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199728 Share on other sites More sharing options...
nick_whitmarsh Posted March 5, 2007 Author Share Posted March 5, 2007 ok cheers anyway mate, hopefully somone else can then :-\ nick Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199731 Share on other sites More sharing options...
Greaser9780 Posted March 5, 2007 Share Posted March 5, 2007 You need to tell it where to mail FROM Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199732 Share on other sites More sharing options...
nick_whitmarsh Posted March 5, 2007 Author Share Posted March 5, 2007 It does say where it mails from, its in the $useraddr string. They type it in themselves on my form. Nick Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199737 Share on other sites More sharing options...
Greaser9780 Posted March 5, 2007 Share Posted March 5, 2007 You need to include that in the mail function: mail( $to, $re, $msg, $useraddr ); Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199742 Share on other sites More sharing options...
nick_whitmarsh Posted March 5, 2007 Author Share Posted March 5, 2007 Ok, I tried that but it still does not send an email I dont get this now. Nick Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199746 Share on other sites More sharing options...
Greaser9780 Posted March 5, 2007 Share Posted March 5, 2007 This is what I use: mail($email, $subject, $message, "From: <[email protected]>\nX-Mailer: PHP/" . phpversion()); Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199749 Share on other sites More sharing options...
nick_whitmarsh Posted March 5, 2007 Author Share Posted March 5, 2007 Tried that too, but it still does not want to send an email. Nick Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199759 Share on other sites More sharing options...
Greaser9780 Posted March 5, 2007 Share Posted March 5, 2007 I don't get it either the code I gave you always works for me. Hopefully someone else can help ya out. Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199762 Share on other sites More sharing options...
redarrow Posted March 5, 2007 Share Posted March 5, 2007 Look at your php.ini is it set correctly? Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199765 Share on other sites More sharing options...
nick_whitmarsh Posted March 5, 2007 Author Share Posted March 5, 2007 I belive it is set correctly. Other features work that I have tried though. Heres my code anyway, ; For Win32 only. SMTP = [email protected] smtp_port = 25 ; For Win32 only. sendmail_from = [email protected] Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199796 Share on other sites More sharing options...
redarrow Posted March 5, 2007 Share Posted March 5, 2007 I dont think you can use hotmail anymore to do this not sure look it up on google. your best bet is to setup the email as the email you was given from your isp ok hot mail see all mail as spam and blocks this ok. example[mail function] ; Setup for Windows systems SMTP = smtp.my.isp.net sendmail_from = [email protected] read this please http://www.sitepoint.com/article/advanced-email-php Link to comment https://forums.phpfreaks.com/topic/41232-help-with-email-function/#findComment-199808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.