• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Pipe email from qmail to PHP

F

fishnyc22

Guest
I've been struggling with this for way too long. Can anyone explain what i'm doing wrong here:

I've set my .qmail file to look like this:
Code:
|/etc/bin/php -q |/var/www/vhosts/domain.com/httpdocs/_phpcgi/test.php
or
Code:
|/etc/bin/php |/var/www/vhosts/domain.com/httpdocs/_phpcgi/test.php

and my php file simply as:
Code:
<?php
// Send
mail('[email protected]','test subject', 'my message goes here');
?>

I'm getting this error:
May 15 01:25:29 as qmail: 1179206729.939189 delivery 2: deferral: No_input_file_specified./



When i try and switch it around:

.qmail looks like this
Code:
|/var/www/vhosts/domain.com/httpdocs/_phpcgi/test.php

php file looks like this
Code:
#!/usr/bin/php -q
<?php
// Send
mail('[email protected]','test subject', 'my message goes here');
?>

When set up like this my error is:
May 15 01:37:36 as qmail: 1179207456.473053 delivery 1: deferral: /bin/sh:_/var/www/vhosts/domain.com/httpdocs/_phpcgi/test.php:_Permission_denied/


I'm running plesk 8.1 on Fedora, My permissions are as follows:

-rwxr-xr-x 1 ftpuser psacln 98 May 15 01:37 test.php

and for qmail:
-r-------- 1 popuser popuser 73 May 15 01:36 .qmail


Any help is really appreciated. Is this the latest method or is there some other way to get this going?
 
Hi fishnyc22,

I've been working on this same problem for a week as well, getting nowhere. I see you get an error message. That is way more than I get. Can I ask what file your error message is showing up in?

As for fixing the error, your second setup gets past finding php, so thats the better route to go at this point. My first thought would be to change the owner of test.php to a user that has executable rights (I would even try root, but just for testing only!).

I would love to hear some experienced input. I'm going crazy with this.
 
I'm hardly "experienced" trust me. I gave up on that a while ago. And then changed servers. I'm now on a CentOS server that seems to not have a qmail binary. Everything points to sendmail. very strange.

a few weeks ago I started looking into other options to parse email. I came across this. Take a look. I got it to a point where it was reading the message in a php page as a test. but had to stop to work on other stuff.

This is a really powerful script. Take a look at:

http://ez.no/ezcomponents

http://ez.no/doc/components/view/latest/(file)/introduction_Mail.html

Let me know if you figure anythign out.
 
I am not an experienced Plesk user, but very experienced at standard qmail installations.

The local delivery of the mail system assumes the user/group of the owner of the mailbox in order to do the delivery.

On the test Plesk system I have just set up (8.1.1), the mailbox files are owned by popuser:popuser.

Try setting the script with that owner and maybe also the group (should not be necessary but try if owner alone does not work).

Cheers
Graham
 
I believe I tried setting it to popuser. I forget. I will be getting back on that part of the project in a week or so and will let you know what I find out.

Thanks for the reply.
 
Put this in your .qmail

| /var/qmail/mail.php

chown popuser:popuser mail.php

Your script will work now. However not alot of other functions will work so i've realised.

Any ideas?
 
Back
Top