Jump to content

mail() function not working!


Karthik

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.