|
-
PHP Email - My script has an error
Hey everyone.
Ok so I have this simple Php script that simply sends an email. However, when I run the Php script online, it produces an error.
The Php script is:
PHP 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>");
}
?>
And the error is:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in \\nas-001\winspace002\10-carsahoy.com\www\Personal\email.php on line 5
Now Im assuming from this error that Im missing the from portion of the email being sent out, and when I tried inserting one, it gave me more errors.
So could someone please show me whats going on?
Many thanks
-
Senior Member
Maybe try changing the call to the mail function like this,
mail($to, $subject, $body, "From: My Site <[email protected]>\r\n")
or you could try using ini_set as suggested here http://uk2.php.net/manual/en/function.mail.php#63101
Last edited by catbert303; 03-27-2006 at 11:05 AM.
-
Great thanks, Ill give it a read
Last edited by Osteel; 03-27-2006 at 11:09 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|