Help - Search - Members - Calendar
Full Version: PHP script unable to send mails...
The Planet Forums > Control Panels > Plesk
SherKhan
I tried all i can find on this forum, plesk and WHT to fix this problem, begin to make me crazy....
My PHP scripts are unable to send mail (inside or outside my server...)
I guess it is due to mail() function but why then my perl scripts and plesk report can.... (plesk is a php script, isn't it?)
This problem come since my server was restored.
I upgraded recently to PHP 4.1.2, but the problem is here from before...
When i check the mail log i just have this line and nothing more happen:
Mar 13 17:04:09 host1 qmail: 1016057049.336347 info msg 33051: bytes 283 from qp 5119 uid 2526
Mar 13 17:04:09 host1 qmail: 1016057049.337261 end msg 33051
Is someone already experienced this problem and how i can fix it?
Thanks for your help.
meballard
Did you check if your php.ini file is being directed to the right sendmail wrapper for qmail for the mail configuration?

Perl scripts would work because they typically have to use their own mail implementation (not relying on a function), and probably the same for the Plesk PHP script (using the mail function isn't the only way to send mail in PHP, but it's certainly the simplest).
SherKhan
Hi Mellabard,
Thanks for your reply and your help,
I checked the sendmail path in my php.ini and it seems to be correct one:
sendmail_path = '/usr/local/psa/qmail/bin/sendmail'
from what i know plesk use qmail and not senmail, and it should be the same for php, shouldn't it?
From what you explain i guess that my script are using the mail() function but i wondered if i should define some permission somewhere to allow them send mail....
phpvortal
What script are u trying to run?? what mail program is it??

recently I installed squirrelmail and found the problem. It turns out that php and qmail have some problem.

apperently qmail is does not like the header info that php sends to qmail and it just rejects it.

The solution was upgrade php to fix this problem. But from what I read you upgraded to the latest php. Hmm... I suppose I don't need to upgrade now.

It is driving me nuts. I have couple other server that has qmail and php installed and they seem to work just fine.

It is driving me nuts but basically what you can do is write your own mail function. and u either go to your script and change mail() to mail2() which mail2 is something that you created.

One easy solution is to connect to smtp socket directly and send out emails.

Anyways, if you do find a solution, plz post it here or pm me and let me know.

phpvortal
SherKhan
I will but right now the problem is staying full....
I tried with some free scripts (e.g:mailing list) to check if the problem comes from mine but apparently it come from php.
I become to be nuts too, the only support i received was to restore the server. For me it isn't a solution, above all when the problem begin with the last restore.
So, if anyone experienced this problem and fixed it, please post it here.
Thanks for all....
Squire
Sherkhan,

I ran into similar symptioms. On my AMD-Plesk server it turned out that the Qmail version installed had a faulty TCP Wrapper. So that the php mail() function wouldn't work at all.

The solution I found, which works fabulously, is to change the sendmail_path line in my php.ini file. You might want to give this a whirl since I spent 4 weeks finding a solution. icon_biggrin.gif

Pico into /usr/local/psa/apache/conf/php.ini and change the sendmail_path line so that it reads:

QUOTE
sendmail_path = /usr/local/psa/qmail/bin/qmail-inject


Assuming you have safe_mode for this domain set to Off that should allow your php script to send mail through Qmail.

Squire
SherKhan
Hip Hip Hip Hurra.
You conclued one month of research and avoid me a restore my friend.
It works, it works great.
And apparently with safe_mode on too....
I don't know how i can thanks you more ???
Yes, my scripts can send mail now, i don't know why this bug exist, and don't allow me to use the sendmail, but if it works with qmail-inject, who cares ???
I will trying attachment now to check if there is some problem.
Without any new post from me, you will understand that it works.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.