barbaric Posted December 9, 2008 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?
Byron Posted December 9, 2008 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
JcX Posted December 9, 2008 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
barbaric Posted December 10, 2008 Author 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"; ?>
JcX Posted December 10, 2008 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now