Jump to content

mail() error


Eskimo

Recommended Posts

I'm trying to put the php function mail() into my website but it seems to not be working.

I have put a condition on it to test, and it keeps failing, which leads me to believe its my code, or the server I'm running it on.

The code is thus:

[code]
<?php

$to = "[email protected]";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
} else {
  echo("<p>Message delivery failed...</p>");
}

?>[/code]

That's all that exists in the script.  Whenever I run it, I get a Message delivery failed error.

Is there anything wrong with the code?  And, if not, what can be done to make this work?

Thanks all.
Link to comment
https://forums.phpfreaks.com/topic/30573-mail-error/
Share on other sites

Archived

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

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