magnetica Posted March 1, 2007 Share Posted March 1, 2007 Ok very simple mail function here. I tested it on my server (not local, remote) and I get the message echo'ed out: The email has been sent. So it seems to work but I check my messages and nothing has come through. By the way I have posted this around 20 minutes after I tried it so it has had plenty of time to come through. Heres the code (anyone tell what i'm doing wrong?) <?php //Email to be sent to $to= "[email protected]"; // Your email address $from= "[email protected]"; // The subject $subject = "Enter your subject here"; // The message $message = "Enter your message here"; mail($to, $subject, $message, "From: $from"); echo "The email has been sent."; ?> Link to comment https://forums.phpfreaks.com/topic/40752-mail-function-simple-but-no-luck/ Share on other sites More sharing options...
phpgal Posted March 1, 2007 Share Posted March 1, 2007 Try adding a newline character. I had same problem and it worked adding that. $success=mail($to, $subject, $body,"From:[email protected]\n"); Link to comment https://forums.phpfreaks.com/topic/40752-mail-function-simple-but-no-luck/#findComment-197300 Share on other sites More sharing options...
magnetica Posted March 1, 2007 Author Share Posted March 1, 2007 I tried that and no luck so would changing the others to have a line break make a difference E.g. $subject = "Enter your subject here\n"; Also why have you added the $success vairable as surely (might be wrong) this would not execute then Link to comment https://forums.phpfreaks.com/topic/40752-mail-function-simple-but-no-luck/#findComment-197312 Share on other sites More sharing options...
magnetica Posted March 1, 2007 Author Share Posted March 1, 2007 %$^&$£ I had it then but uploaded over it.. $%£^£ Link to comment https://forums.phpfreaks.com/topic/40752-mail-function-simple-but-no-luck/#findComment-197322 Share on other sites More sharing options...
phpgal Posted March 1, 2007 Share Posted March 1, 2007 try using direct email id in from header in lieu of variable . It sometimes helps. Also check your server setting. mail($to,$subject,$body,"From:test.test.com\n"); Link to comment https://forums.phpfreaks.com/topic/40752-mail-function-simple-but-no-luck/#findComment-197338 Share on other sites More sharing options...
magnetica Posted March 1, 2007 Author Share Posted March 1, 2007 I have it now. Works fine. I used <?php $body = "Someone submitted"; $subject = "hello"; mail("[email protected]", $subject, $body, "From: Sean Jenkins"); echo "email sent successfully"; ?> Link to comment https://forums.phpfreaks.com/topic/40752-mail-function-simple-but-no-luck/#findComment-197349 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.