Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having some issues with setting up piping to a php app (WHMCS).

The mail is coming to the server however it is bouncing.

The maillog shows:-

May 15 12:51:14 hostname postfix/smtpd[2123]: connect from mail-wi0-f177.google.com[209.85.212.177]
May 15 12:51:14 hostname postfix/smtpd[2123]: D475CBB83F: client=mail-wi0-f177.google.com[209.85.212.177]
May 15 12:51:17 hostname postfix/cleanup[2133]: D475CBB83F: message-id=<847AAA86-C2A5-4CE5-9C44-AFCC9CAFA27D@googlemail.com>
May 15 12:51:17 hostname postfix/qmgr[1922]: D475CBB83F: from=<emailaddress@googmlemail.com>, size=2501, nrcpt=1 (queue active)
May 15 12:51:17 hostname postfix/local[2134]: warning: database /etc/aliases.db is older than source file /etc/aliases
May 15 12:51:17 hostname postfix/smtpd[2123]: disconnect from mail-wi0-f177.google.com[209.85.212.177]
May 15 12:51:17 hostname postfix/local[2134]: D475CBB83F: to=<localmailbox@mydomain.com>, relay=local, delay=2.6, delays=2.5/0/0/0.04, dsn=2.0.0, status=sent (delivered to command: php)
May 15 12:51:17 hostname postfix/local[2134]: D475CBB83F: to=<localmailbox@mydomain.com>, relay=local, delay=2.6, delays=2.5/0/0/0.09, dsn=5.1.3, status=bounced (bad recipient address syntax: -q@mydomain.com)
May 15 12:51:17 hostname postfix/local[2134]: warning: unable to create lock file /srv/mydomain.com/public_html/pipe/pipe.php.lock: Permission denied
May 15 12:51:17 hostname postfix/local[2134]: D475CBB83F: to=<localmailbox@mydomain.com>, relay=local, delay=2.7, delays=2.5/0/0/0.12, dsn=5.2.0, status=bounced (cannot append message to file /srv/mydomain.com/public_html/pipe/pipe.php: cannot open file: Permission denied)
May 15 12:51:17 hostname postfix/cleanup[2133]: 7C2B3BB842: message-id=<20130515115117.7C2B3BB842@mydomain.com>
May 15 12:51:17 hostname postfix/bounce[2136]: D475CBB83F: sender non-delivery notification: 7C2B3BB842
May 15 12:51:17 hostname postfix/qmgr[1922]: 7C2B3BB842: from=<>, size=5028, nrcpt=1 (queue active)
May 15 12:51:17 hostname postfix/qmgr[1922]: D475CBB83F: removed
May 15 12:51:18 hostname postfix/smtp[2137]: 7C2B3BB842: to=<myemail@googlemail.com>, relay=aspmx.l.google.com[2a00:1450:400c:c05::1b]:25, delay=0.61, delays=0.03/0/0.2/0.38, dsn=2.0.0, status=sent (250 2.0.0 OK 1368618678 kt8si636900wjb.97 - gsmtp)
May 15 12:51:18 hostname postfix/qmgr[1922]: 7C2B3BB842: removed

I have tried to chown postfix the /pipe directory however this didn't work I also chmodded it to 777 making sure it wasn't the problem.

Neither fixed the issue.

Is there anything else I need to do to set piping up?

Thanks

share|improve this question
    
You seriously intend to append emails to a PHP file? This doesn't make any sense to me. –  Hauke Laging May 15 '13 at 12:06
    
I don't want to append emails to the file. I setup an alias to pipe to a php script. In /etc/aliases myemail: | php -q /srv/mydomain.com/public_html/pipe/pipe.php –  user173801 May 15 '13 at 12:16
    
See the edit of my answer. –  Hauke Laging May 15 '13 at 12:27

2 Answers 2

up vote 0 down vote accepted

Not that I think it is a good idea to do that but for appending to a file a process needs write access to the file not to its directory.

But I assume that Postfix is trying to do something different from what you expect...

Edit 1:

| php -q /srv/mydomain.com/public_html/pipe/pipe.php

is an error:

Commands that contain special characters, such as whitespace, should be enclosed between double quotes.

So that is probably not recognized as one command but as separate Postfix operations:

  1. pipe to php
  2. whatever
  3. append to /srv/mydomain.com/public_html/pipe/pipe.php
share|improve this answer
    
Got it working. I set the alias to:- mailbox: |"php -q /srv/mydomain.com/public_html/pipe.pipe.php" Thank you very much! :) –  user173801 May 15 '13 at 12:35

Related: Postfix unable to create lock file, permission denied

As stated, ensure postfix has full access to /var/mail/vhosts to work properly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.