Why the mail cant work?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wish
    New Member
    • May 2007
    • 65

    #1

    Why the mail cant work?

    Hi all,

    [CODE=php]
    <?
    $email="you@exa mple.com";
    $subject="Enter your subject here";
    $message="Enter your message here";
    mail($email,$su bject,$message, "From:$emai l");
    ?>
    [/CODE]

    Why the mail i cant receive? Is it got setting in linux?

    Can anyone guide me?

    Thanks in advance.
    Last edited by Atli; Oct 25 '07, 01:40 AM. Reason: Changed [code] tags to [code=php].
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    What exactly is the problem?
    Are you getting any errors?

    The code itself looks OK. Should work.

    Comment

    • wish
      New Member
      • May 2007
      • 65

      #3
      No error and no output. I keep check my mail box but the mail is not coming.

      Is it use mail function in php got other settings to allow the mail function to work?

      If yes, please guide me where should i change the settings.

      Thanks.

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        The mail() function returns a boolean value, indicating whether or not it was successful. So I recommend doing something like this:
        [code=php]
        if(mail(...)) {
        echo "Mail sent successfully.";
        }
        else {
        echo "Mail could not be sent!";
        }
        [/code]

        You will need set the values for 'SMTP' and 'smtp_port' in your php.ini file to a valid SMTP server.

        Comment

        • wish
          New Member
          • May 2007
          • 65

          #5
          Hi,

          where is the php.ini located?

          Is it i change the SMTP then is ok?Cos i am new for linux setting.

          I try now.

          Thanks.

          Comment

          Working...