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

mail() in PHP doesn't work with Qmail

Discussion in 'Plesk for Linux - 8.x and Older' started by mooiesite, Jul 1, 2006.

  1. mooiesite

    mooiesite Basic Pleskian

    24
    23%
    Joined:
    Jun 17, 2006
    Messages:
    66
    Likes Received:
    0
    Mail(); in PHP doesn't do anything.

    Using mail in a shell isn't a problem, so sendmail is working!

    PHP doesn't give me any errors (error reporting: ALL)

    PHP.ini contains the right path to sendmail. I tried all the options like:

    ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
    sendmail_path = /var/qmail/bin/sendmail

    or
    sendmail_path= /var/qmail/bin/qmail-inject

    In phpinfo() all the paths are right, but it doesn't mail anything (neither internally or with external mailaddresses)

    I check the rights, even chmod 777 on sendmail or qmail-inject doesn't do a thing.

    Even this doesn't work:
    as root:
    # /usr/bin/php -f test.php

    and test.php is this:
    <?
    ini_set('error_reporting', E_ALL);
    $mailHeaders = "From: domain.nl <info@domain.nl>";
    $mailSubject = "Test";
    $mailBody = "Test body";
    $mailTo = "info@domain.nl";
    mail($mailTo, $mailSubject, $mailBody, $mailHeaders);
    ?>

    Is there anyone who knows how to fix this or knows a work-around?
     
  2. Poor_Knight

    Poor_Knight Guest

    0
     
    I'm having a similar problem. Web forms using the mail() function are no longer sending emails to certain domains. gmail, hotmail, etc. will receive the email, but not other domains.

    I say no longer send emails because I moved from a shared hosting server to a VPS. They were working previously. Any more info on this?
     
  3. talesa

    talesa Guest

    0
     
    I'm having the same problem. Anyone found the fix?

    Trevor
     
  4. frostie

    frostie Guest

    0
     
    Have you tried issuing a sendmail command from the command line?

    #> sendmail -f<fromuser@domain.com> -t -v <touser@domain.com> < ~somefilename

    What output does that give you?

    Regards J
     
  5. w3prodigy

    w3prodigy Guest

    0
     
    Has anyone found a resolution to this issue?
     
  6. freaky@

    freaky@ Regular Pleskian

    26
     
    Joined:
    May 2, 2006
    Messages:
    104
    Likes Received:
    0
    Yea anyone?

    Even worse, php webpages seem to execute. Using the php CLI in interactive mode it will seg fault right after the mail command.
     
  7. faris

    faris Guest

    0
     
    This probably isn't the solution but....

    In the past when php segfaulted on me it was usually down to having an older version of Zend optimizer installed.

    So as a first step you might want to try installing the very latest zend (and ioncube if necessary) and make sure that any older Zend/Ioncube entries are removed from php.ini.

    Faris.
     
  8. w3prodigy

    w3prodigy Guest

    0
     
    If you have access to your DNS records, some of you may want to check and make sure your mail's MX record is properly setup if your mail is being hosted elsewhere, this solved the issue for me but we just have a really odd server setup. I hate it -_-
     
  9. freaky@

    freaky@ Regular Pleskian

    26
     
    Joined:
    May 2, 2006
    Messages:
    104
    Likes Received:
    0
    Disabling selinux solved it for me (that is, the interpreter in apache, the php cli still segfaults if i call mail() even with selinux entirely disabled).
     
  10. faris

    faris Guest

    0
     
    That's extremely worrying. selinux bit me on the behind with another problem not so long ago. It is so annoying. It has so many benefits but too many problems.

    Faris.
     
  11. blank_page

    blank_page Regular Pleskian

    24
    53%
    Joined:
    Dec 17, 2006
    Messages:
    229
    Likes Received:
    0
    Hello,


    I do not believe that you can use mail() with sendmail path :

    /var/qmail/bin/sendmail

    use simply :

    /usr/sbin/sendmail


    As for hotmail and gmail they are very strict in filtering their email. Try to use spf's maybe that will help.
     
  12. freaky@

    freaky@ Regular Pleskian

    26
     
    Joined:
    May 2, 2006
    Messages:
    104
    Likes Received:
    0
    Why would you believe that and why wouldn't it be possible?

    It works... :) In fact, the qmail sendmail binary is recommended on many forums if you use qmail. Normally /usr/sbin/sendmail should be a symlink to it, but appearantly fedora or plesk (whatever installed qmail) screwed up creating the symlink. As I don't want an update to qmail or whatever to break the link again I just pointed it to the binary.
     
  13. Jllynch

    Jllynch Regular Pleskian

    28
     
    Joined:
    Nov 11, 2003
    Messages:
    242
    Likes Received:
    0
  14. freaky@

    freaky@ Regular Pleskian

    26
     
    Joined:
    May 2, 2006
    Messages:
    104
    Likes Received:
    0
    Thanks for the re...

    At the risk of sounding stupid, can anyone explain why ppl keep proposing solutions on something that's already solved? :D Cuz I can't figure it out...
     
  15. w3prodigy

    w3prodigy Guest

    0
     
    Well, sometimes (like my times), we don't have access to use that resolution, and frankly: my hosting guy isn't as bright as i'd like him to be.
     
  16. TellUsMore

    TellUsMore Guest

    0
     
    same problem

    same problem, mail won't send off the box with a php mail(), old server worked perfect, new server well you all know.

    I tried the selinux permissive etc... no effect at all.

    seems there should be a difinative solution here as everyone is having the same exact issue? I did have plesk 7 and now i have plesk 8?

    this is horrible anyone have THE answer?
     
  17. crnunez

    crnunez Regular Pleskian

    25
    90%
    Joined:
    May 24, 2006
    Messages:
    124
    Likes Received:
    0
    solution

    Hello,
    You should reinstall Qmail package from plesk, please looking for inside Plesk folders after download the correct version.

    Why it occur?

    Because, Plesk first compile PHP and not Qmail then is neccesary reinstall Qmail with --force for PHP works fine with mail()...

    Regards.
     
  18. TellUsMore

    TellUsMore Guest

    0
     
    My solution

    Ok I figured this out last night

    http://kb.swsoft.com/article_22_144_en.html

    1) 127.0.0.0/8 network is added to white list in Plesk CP (Server-> Mail -> White List)

    2) Make sure that /usr/sbin/sendmail and /usr/lib/sendmail are a
    symbolic links to Plesk sendmail binary (/var/qmail/bin/sendmail).

    and then adjusted my php to

    1. Log in as ROOT to your server and do the following:
    2. Issue these root commands:
    a. cd /usr/sbin (this changes to the directory)
    b. readlink sendmail (this displays where the symbolic link points.)
    > In my case it was pointing to: /etc/alternatives/mta/sendmail
    > That is good.
    c. cd /usr/lib (change to next directory)
    d. readlink sendmail (again, show where it points).
    > In my case, nothing displayed because the file/link did not exist.
    > I then ran the command to create a symbolic link
    > ln -s /etc/alternatives/mta sendmail
    > Now when I use readlink sendmail it gives me this symbolic link
    3. That was it… My sendmail from within PHP now worked.

    here is the thread.

    http://forum.swsoft.com/showthread.php?s=&threadid=44434&highlight=php+mail
     
Loading...