A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: PHP Email - My script has an error

  1. #1
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167

    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

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    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.

  3. #3
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center