Jump to content

Archived

This topic is now archived and is closed to further replies.

Karthik

mail() function not working!

Recommended Posts

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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[!--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!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.