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 = "[email protected]";// The subject$subject = "subject";// The message$message = "message";$result=mail($email1, $subject, $message, "From: [email protected]");if ($result){echo "<br> Sent!";}else echo "<br> Sending Failed.";---------------------------------------------------------------$to = '[email protected]';$subject = 'Test';$message = 'Test message';$headers = 'From: [email protected]' . "\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('[email protected]', '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... 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. 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! Link to comment https://forums.phpfreaks.com/topic/9246-mail-function-not-working/#findComment-34105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.