Karthik Posted May 7, 2006 Share Posted May 7, 2006 The mail() function is not working for me. I'm on a webhost...Here's the different variations of code that I've tried: ------------------------------------------------------// Your email address$email1 = "me@mymail.com";// The subject$subject = "subject";// The message$message = "message";$result=mail($email1, $subject, $message, "From: me@mymail.com");if ($result){echo "<br> Sent!";}else echo "<br> Sending Failed.";---------------------------------------------------------------$to = 'me@mymail.com';$subject = 'Test';$message = 'Test message';$headers = 'From: website@whatever.com' . "\r\n";if(mail($to, $subject, $message, $headers)){ echo "<br> Success";} else { echo "<br> Failure";}--------------------------------------------------------The below code was taken from php.net--------------------------------------------------------// The message$message = "Line 1\nLine 2\nLine 3";// In case any of our lines are larger than 70 characters, we should use wordwrap()$message = wordwrap($message, 70);// Sendif(mail('me@mymail.com', 'My Subject', $message)){ echo "<br> Success";} else { echo "<br> Failure";}---------------------------------------------------------------The thing is that the first set of codes were working till recently! And again, the same set of codes work on a different server, but my hosts say nothing's been changed!Thanks for helping... Quote Link to comment https://forums.phpfreaks.com/topic/9246-mail-function-not-working/ Share on other sites More sharing options...
wildteen88 Posted May 7, 2006 Share Posted May 7, 2006 There is usally a delay when sending an email with mail. Also check that your email client isn't putting your emails into the Junk/Spam folder. Quote Link to comment https://forums.phpfreaks.com/topic/9246-mail-function-not-working/#findComment-34053 Share on other sites More sharing options...
Karthik Posted May 7, 2006 Author Share Posted May 7, 2006 [!--quoteo(post=372033:date=May 7 2006, 10:42 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 7 2006, 10:42 AM) [snapback]372033[/snapback][/div][div class=\'quotemain\'][!--quotec--]There is usally a delay when sending an email with mail. Also check that your email client isn't putting your emails into the Junk/Spam folder.[/quote]Got it fixed, there was some problem with my server...thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/9246-mail-function-not-working/#findComment-34105 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.