barbaric Posted December 9, 2008 Share Posted December 9, 2008 I was trying to create a comment page for visitors to my site using php. For some reason I can't get the mail() function to send mail. I've added the headers recommended by php.net users, but it still won't work. What other details do I need? Quote Link to comment Share on other sites More sharing options...
Byron Posted December 9, 2008 Share Posted December 9, 2008 I just now tried this on my site and it worked just fine: <?php $tomail = "your-addy@yahoo.com"; $frommail = "anybody@yahoo.com"; $subject = "Test Email"; $message = "This is a test."; mail($tomail, $subject, $message, "From: $frommail"); echo "The email has been sent."; ?> Make sure you check your spam folder. Byron Quote Link to comment Share on other sites More sharing options...
JcX Posted December 9, 2008 Share Posted December 9, 2008 Tell us which email account you using? I'm currently using yahoo, by adding stevie.heliohost.org into trusted list. My hotmail used to receive mail too, but not now. Problem : unknown Quote Link to comment Share on other sites More sharing options...
barbaric Posted December 10, 2008 Author Share Posted December 10, 2008 I'm using a gmail account for the receiving address. Will certain mail accounts not receive properly? This is the code i used to test the mail function: <?php $sendto = "myemail@gmail.com"; $subject = "Subject"; $from = "nobody@nowhere.edu"; $headers = 'From: '.$from."\r\n".'Reply-To: '.$from."\r\n"; $body = "This will work. I insist upon it. \r\n"; mail( $sendto, $subject, $body, $headers ); echo "it worked"; ?> Quote Link to comment Share on other sites More sharing options...
JcX Posted December 10, 2008 Share Posted December 10, 2008 Like Byron said, check your Spam folder. I'm not sure about gmail since i'm not using it. Add stevie.heliohost.org into trusted list as I do in yahoo mail. 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.