Jump to content


Photo

mail() function not working!


  • Please log in to reply
2 replies to this topic

#1 Karthik

Karthik
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 07 May 2006 - 03:39 PM

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);

// Send
if(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...

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 07 May 2006 - 03:42 PM

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.

#3 Karthik

Karthik
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 07 May 2006 - 06:30 PM

[!--quoteo(post=372033:date=May 7 2006, 10:42 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 7 2006, 10:42 AM) View Post[/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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users