Hello, I'm no expert in email servers or configs, but I'm building a small help system where basically some mail accounts of my email server are piped into a PHP script that will take care of the emails.
The server is running, I can send email over SMTP without any issues, I can also receive them on the users virtual mailboxes and access them over IMAP. However, there's a problem, I'm using this rule to pipe the emails:
Code:
smtpd_recipient_restrictions = check_recipient_access mysql:/etc/postfix/mysql-virtual-recipient-access.cf, permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
Bassically the SQL query referenced on
/etc/postfix/mysql-virtual-recipient-access.cf returns the following every time its supposed to pipe a specific mailbox to PHP:
Code:
FILTER ticket:dummy
And then I've a hook defined at
master.cf like this:
Code:
ticket unix - n n - - pipe
flags=F user=www-data argv=/webroot/tiketman/AppCore/Mail/Incoming.php ${sender} ${size} ${recipient}
This setup works fine if I send and email from an address inside or outside my server, however local bounces like
Mail Delivery Notifications originated on my server such as
Code:
<error@sfasdadf.com>: Host or domain name not found. Name service error for
name=sfasdadf.com type=A: Host not found
Don't get filtered and aren't not piped to PHP ending up on the user mailbox.
Here is
/var/log/mail.log on sending a test email and receiving the error back:
Quote:
Sep 19 23:09:11 mail postfix/smtp[8773]: 764E2409DF: to=<email@sfasdadf.com>, relay=none, delay=0.14, delays=0.11/0.01/0.02/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=sfasdadf.com type=A: Host not found)
Sep 19 23:09:11 mail postfix/cleanup[8771]: 970D2409E1: message-id=<20140919210911.970D2409E1@mail.ptdyncs.com>
Sep 19 23:09:11 mail postfix/bounce[8774]: 764E2409DF: sender non-delivery notification: 970D2409E1
Sep 19 23:09:11 mail postfix/qmgr[8638]: 970D2409E1: from=<>, size=3583, nrcpt=1 (queue active)
Sep 19 23:09:11 mail postfix/qmgr[8638]: 764E2409DF: removed
Sep 19 23:09:11 mail dovecot: lmtp(8777): Connect from local
Sep 19 23:09:11 mail dovecot: lmtp(8777, test-1@ptdyncs.com): FXZGJnebHFRJIgAAvu7YNA: msgid=<20140919210911.970D2409E1@mail.ptdyncs.com>: saved mail to INBOX
Sep 19 23:09:11 mail postfix/lmtp[8776]: 970D2409E1: to=<test-1@ptdyncs.com>, relay=mail.ptdyncs.com[private/dovecot-lmtp], delay=0.04, delays=0.01/0.01/0.01/0.02, dsn=2.0.0, status=sent (250 2.0.0 <test-1@ptdyncs.com> FXZGJnebHFRJIgAAvu7YNA Saved)
Sep 19 23:09:11 mail dovecot: lmtp(8777): Disconnect from local: Client quit (in reset)
Sep 19 23:09:11 mail postfix/qmgr[8638]: 970D2409E1: removed
|
How can I fix this, without changing much the architecture of this thing, because I need to be able to set the hook that will process the messages (or none) at SQL for each virtual user.
From some reading I've been doing the local bounce notifications aren't actually sent like a normal email and are processed by the bounce program, however, I'm not sure I understood it correctly because on the log above I see a full delivery. My attempts to catch that email above (with global pipes and stuff) only made me get to the conclusion that I effectively get the email I sent back to me, but here no error message :S
Can someone explain me this more detailed and help me fix it? I've been doing research and I can't find anything useful... it this that hard? There must be other applications doing this...
Thank you.