Help - Search - Members - Calendar
Full Version: problems sending email via php scripts
The Planet Forums > Control Panels > Plesk
Gentle Giant
Hi,

I am having big problems sending email via php scripts.

I have set up a test script...

[PHP]mail("user@example.com", "Test email", "Test email");
echo "this is an email test";
?> [/PHP]

and watched my maillog

When I run it from root, it works, and the mail is delivered. When I run it from the browser no mail is delivered icon_sad.gif

In the maillog for the failed attempts I get...

[PHP]Feb 15 21:33:51 servername qmail: 1045344831.225720 new msg 6193285
Feb 15 21:33:51 servername qmail: 1045344831.225790 info msg 6193285: bytes 262 from qp 5896 uid 48
Feb 15 21:33:51 servername qmail: 1045344831.228897 end msg 6193285
[/PHP]

Email works fine in cgi scripts from the server, but not via any php scripts on the server icon_sad.gif

Running 5.0.5 on RH 7.3

Any thoughts?
Rich2k
Try putting a from address in the headers


mail("someone@somewhere.com", "Subject", "Message", "From: Name n");
niceguy167
i think there is a post on this somewhere as to have to fix it
Berlin
I have the same problem with my php scripts. Whitelisting 127.0.0.1./24 doesn't work.
Berlin
QUOTE
Originally posted by Rich2k
Try putting a from address in the headers


mail("someone@somewhere.com", "Subject", "Message", "From: Name n");


This shouldn't be necessary if Psa is working properly.
NightHawk
QUOTE
Originally posted by Gentle Giant
Hi,

I am having big problems sending email via php scripts.

I have set up a test script...

[PHP]mail("user@example.com", "Test email", "Test email");  
echo "this is an email test";  
?> [/PHP]  



Email works fine in cgi scripts from the server, but not via any php scripts on the server icon_sad.gif

Running 5.0.5 on RH 7.3

Any thoughts?


I find this to be strange...as the above script sends mail everytime on my plesk 7.3 rpm box...(dual xeon btw here at RS).
Berlin
QUOTE

[PHP]mail("user@aol.com", "Test email", "Test email");  
echo "this is an email test";  
?> [/PHP]  


here's my result:

Mar 12 02:58:38 plesk qmail: 1047459518.089612 new msg 5079176
Mar 12 02:58:38 plesk qmail: 1047459518.089787 info msg 5079176: bytes 245 from qp 4320 uid 48
Mar 12 02:58:38 plesk qmail: 1047459518.098607 end msg 5079176

Recieved nothing.
Berlin
Dear Customer,

PHP is now properly sending mail. I changed a configuration setting in

/etc/php.ini

Here is what I changed:
[root@plesk mailnames]# grep qmail-inject /etc/php.ini
sendmail_path = /var/qmail/bin/qmail-inject

For systems with qmail you need to use "qmail-inject" instead of
"sendmail".

If you have any other problems then please feel free to describe them in
detail and we will endeavor to address them to the best of our ability.

Thanks for using RackShack.net.
NightHawk
QUOTE
Originally posted by Berlin
Dear Customer,

PHP is now properly sending mail.  I changed a configuration setting in

/etc/php.ini

Here is what I changed:
[root@plesk mailnames]# grep qmail-inject /etc/php.ini
sendmail_path = /var/qmail/bin/qmail-inject

For systems with qmail you need to use "qmail-inject" instead of
"sendmail".

If you have any other problems then please feel free to describe them in
detail and we will endeavor to address them to the best of our ability.

Thanks for using RackShack.net.


If you had to do that..then your symlinks for sendmail were not working properly...but anyway..glad it works for you now...
d-woo
I have made the changes to [root@server mailnames] and in /etc/php.ini...to no avail.

I'm just reading up on symlinks.

What is the correct syntax to get this working?

Thanks!
NightHawk
QUOTE
Originally posted by d-woo
I have made the changes to [root@server mailnames] and in /etc/php.ini...to no avail.

I'm just reading up on symlinks.

What is the correct syntax to get this working?

Thanks!


for the plesk standard it would be:

ln -s /usr/local/psa/qmail/bin/sendmail /usr/sbin/sendmail

for the rpm install it would be:

ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
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.