Piping mail to script

2012-08-03 Thread DN Singh
Hello Group,

I have a setup to receive mails for a subdomain, which is also the hostname
of the server. I want to use system users as mailboxes. This used to work
fine until I implemented catch-all address. I added an entry @domain.tld
  u...@domain.tld in virtual map. But, all mails went to that
user. So, I ended up creating an entry for each and every user in virtual
map. But, this does not seem feasible since I want to use system user.
Next, I want to pipe all the unrouted mail (catch-all mechanism) to a php
script. But, I do not understand how to do this. Below is the output of
'postconf -n':

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
bounce_queue_lifetime = 1d
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
header_checks = regexp:/etc/postfix/header_checks
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
maximal_queue_lifetime = 1d
mydestination = $myhostname, localhost.$mydomain, localhost
myhostname = subdomain.domain.tld
mynetworks_style = subnet
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_client_connection_rate_limit = 100
smtpd_client_message_rate_limit = 100
smtpd_helo_restrictions = permit_mynetworks, reject_rbl_client
psbl.surriel.com, reject_rbl_client sbl-xbl.spamhaus.org
smtpd_recipient_restrictions = permit_mynetworks,
 reject_unauth_destination reject_non_fqdn_helo_hostname
reject_invalid_helo_hostname reject_unlisted_recipient
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

Cheers


Re: Piping mail to script

2012-08-03 Thread Ansgar Wiechers
On 2012-08-03 DN Singh wrote:
 I have a setup to receive mails for a subdomain, which is also the
 hostname of the server. I want to use system users as mailboxes. This
 used to work fine until I implemented catch-all address. I added an
 entry @domain.tld u...@domain.tld in virtual map. But, all mails
 went to that user.

Umm... yes. This is expected behavior. Not to mention that a catch-all
is a Really Bad Idea(tm) to begin with. What problem are you trying to
solve by doing this?

Regards
Ansgar Wiechers
-- 
Abstractions save us time working, but they don't save us time learning.
--Joel Spolsky


Re: Piping mail to script

2012-08-03 Thread DN Singh
On Fri, Aug 3, 2012 at 2:29 PM, Ansgar Wiechers li...@planetcobalt.netwrote:

 On 2012-08-03 DN Singh wrote:
  I have a setup to receive mails for a subdomain, which is also the
  hostname of the server. I want to use system users as mailboxes. This
  used to work fine until I implemented catch-all address. I added an
  entry @domain.tld u...@domain.tld in virtual map. But, all mails
  went to that user.

 Umm... yes. This is expected behavior. Not to mention that a catch-all
 is a Really Bad Idea(tm) to begin with. What problem are you trying to
 solve by doing this?

 I have newsletter setup of around 4k users. I am trying to implement verp
to parse bounced email-ids. So, I need to implement catch-all setup. I have
tested the script with IMAP and am not satisfied with the result. So, I
want to test the other work-around where in, the script gets called
directly for each and every mail.
If the piping method works, I might even try other functions with different
mailboxes.

Regards
 Ansgar Wiechers
 --
 Abstractions save us time working, but they don't save us time learning.
 --Joel Spolsky



Re: Piping mail to script

2012-08-03 Thread Viktor Dukhovni
On Fri, Aug 03, 2012 at 03:47:16PM +0530, DN Singh wrote:

 I have newsletter setup of around 4k users. I am trying to implement verp
 to parse bounced email-ids. So, I need to implement catch-all setup. I have
 tested the script with IMAP and am not satisfied with the result. So, I
 want to test the other work-around where in, the script gets called
 directly for each and every mail.

You DO NOT need a catch-all, rather you need to set the
recipient_delimiter to match the one used in your VERP envelopes,
and configure mail delivery for the base address (sans extension).

-- 
Viktor.