php and mail - please help

Discussion in 'Programming/Scripts' started by rosy, Nov 16, 2006.

  1. rosy

    rosy New Member

    I am working on Linux Debian (Exim 3.36 mail server).
    when i tried using mail command in command line argument,
    its working and when i am using php mail to send mail
    its not working.
    Do i need to explicitly give sendmail_path.
    I got no errors.
    please help.
  2. sjau

    sjau Local Meanie Moderator

    What is the error you get when you try to use php mail();?
  3. rosy

    rosy New Member

    I got error which says
    Message delivery failed...Can't send email
    i used the command
    $to = "[email protected]";
    $from = "[email protected]";
    $subject = "Hi test";
    $body = "Testing Email";

    $headers = "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
    $headers .= "From:$from";

    mail($to, $subject, $body, $headers);
    if (mail($to, $subject, $body, $headers))
    echo("<p>Message successfully (root)sent!to $to</p>");

    } else {
    echo("<p>Message delivery failed...Can't send email to $to</p>");
    please help me finding the error.
  4. falko

    falko Super Moderator Howtoforge Staff

    What's in your mail log when you try to send a mail using PHP?
  5. rosy

    rosy New Member

    In my mail log , i got
    2006-11-17 09:38:01 Start queue run: pid=4326
    2006-11-17 09:38:01 End queue run: pid=4326
    please help.why i am receiving the error message?
    I could not able to receive mail in my mailbox?
    i used phpinfo() in my program it gives
    sendmail_from no values
    sendmail_path /usr/sbin/sendmail
    smtp localhost
    smtp_port 25

    Thanks in advance.
  6. falko

    falko Super Moderator Howtoforge Staff

    I've seen in your other thread that you solved the problem?
  7. CyberSpatium

    CyberSpatium New Member

Share This Page