0

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

2 Answers2

0

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
Hauke Laging
  • 5,157
  • 2
  • 23
  • 40
  • 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
0

Related: Postfix unable to create lock file, permission denied

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

Nathan C
  • 14,901
  • 4
  • 42
  • 62