1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

php mail not working

Discussion in 'Plesk for Linux - 8.x and Older' started by vprasad84, Feb 8, 2008.

  1. vprasad84

    vprasad84 New Pleskian

    22
    73%
    Joined:
    Jan 22, 2008
    Messages:
    10
    Likes Received:
    0
    hi,

    all of a sudden the php mail is not delivering the emails to the recepients. kindly find a sample code which i am running

    <?php
    $to = "prasad@itisl.com";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you.......?";
    $headers = "From: prasad@itisl.com\r\n" .
    "X-Mailer: php";
    if (mail($to, $subject, $body, $headers)) {
    echo("<p>Message sent!</p>");
    } else {
    echo("<p>Message delivery failed...</p>");
    }
    ?>


    even after hitting this page, i get the 'Message Sent' message which indicates that the mail is properly processed by php however i am unable to get the mail in my mailbox. too my mailbox is on the same server itself. Also verified that tte sendmail path in /etc/php.ini is still set to /var/qmail/bin/sendmail

    we are even unable to see any errors in maillog. In maillog it shows as the message is submitted by anonymous@(our hostname)

    All was working fine before the plesk upgrade of 7.5 > 8.3 but seems that after upgradation it has stopped working,kindly suggest with this regards
     
  2. c0demaster

    c0demaster Guest

    0
     
    Hello vprasad84

    A 'feature/bug' :) has appeared in Plesk versions 8.x. that doesn't comply with RFC 2822 in the mail() function.

    Replace the \r\n in the $headers section of your code with just \n and your emails should then work as expected.
     
  3. c0demaster

    c0demaster Guest

    0
     
    I've just spotted that you also need to add a line-feed (\n) after X-Mailer: php
    i.e. X-Mailer: php\n"
     
Loading...