webdevdea Posted July 31, 2013 Share Posted July 31, 2013 Im working from this fun PHP sql book while I am out for a few weeks, I am working on an alien abduction form lol its supposed to mail it to me..here is my code for that part.. can you tell me what I am doing wrong with it? $to = 'webdevdea@gmail.com'; $subject = 'Aliens Abducted Me - Abduction Report'; $msg = "$name was abducted $when_it_happened and was gone for $how_long.\n" . "Number of aliens: $how_many\n"; "Alien Description: $alien_description\n"; "What they did: $what_they_did\n"; "Fang Spotted: $fang_spotted\n"; "Other Comments: $other"; mail($to, $subject, $msg, 'From:' . $email); Quote Link to comment https://forums.phpfreaks.com/topic/280658-maill/ Share on other sites More sharing options...
0xMatt Posted July 31, 2013 Share Posted July 31, 2013 You should tell us what is wrong. Are you getting a php error? No, because I used your script on my localhost and sent the email to myself which works. Have you checked your mail logs for errors? Do you have sendmail configured properly? Quote Link to comment https://forums.phpfreaks.com/topic/280658-maill/#findComment-1442743 Share on other sites More sharing options...
gristoi Posted July 31, 2013 Share Posted July 31, 2013 are you running this from your local machine or from a web server. if you are running it from your local machine then you need to make sure your mail client is configured correctly Quote Link to comment https://forums.phpfreaks.com/topic/280658-maill/#findComment-1442771 Share on other sites More sharing options...
webdevdea Posted July 31, 2013 Author Share Posted July 31, 2013 Yeah I didnt look in my junk box, I thought it was not working, I apologize i am new to this just trying to work out some bugs lol .. are you running this from your local machine or from a web server. if you are running it from your local machine then you need to make sure your mail client is configured correctly Quote Link to comment https://forums.phpfreaks.com/topic/280658-maill/#findComment-1442823 Share on other sites More sharing options...
jazzman1 Posted July 31, 2013 Share Posted July 31, 2013 Try to send this exampe from php.net: <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/280658-maill/#findComment-1442863 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.