Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BounceBack by Domain?

Status
Not open for further replies.

Anacreo

IS-IT--Management
Sep 13, 2011
2
I have a postfix environment with the master.cf sending mail for different domains on different IP addresses.

I also have a mass mailer that wants to scan a POP mailbox for non delivery notifications.

Is there a way to have Postfix adjust the bounce_notice_recipient based on the master.cf?

Note that the example below doesn't work:
domain1 unix - - n - - smtp
-o smtp_bind_address=10.10.100.206
-o smtp_helo_name=domain1.com
-o bounce_notice_recipient=bouncebacks.domain1
-o 2bounce_notice_recipient=bouncebacks.domain1

My next idea is to parse a global bouncebacks mail box and send the notifications out to the right recipient by domain name, so if anyone has a suggested script for this I'm all ears.

Thanks for the support.
 
Off hand, I don't have any ideas for having Postfix adjust the bounce notice list. However, as far as a script, naturally the idea is to use a responsive content filter. For this application, I would take a look at a utility called CMUSieve. It scans email headers for designated fields and edit or move them accordingly. Typically, these types of scripts are written in PERL and you should be able to adapt them to send a message in response to bounced header, assuming they don't support that feature already.
 
Noway2,
Thanks a lot for the information here. I am going along those lines but I actually need to do things based on the body content to find the original From: address.

Perhaps there is a tricky way of doing this in PostFix...
bounce_notice goes to bouncebacks
bouncebacks goes to bounce.domain1, bounce.domain2
Is there some way of then doing a content filter (and only on these particular e-mail addresses) via Postfix before delivering to bounce.domain1, and bounce.domain2 that ensures the domain is mentioned in the e-mail (respective to the e-mail address)?

My least elegant, but probably most practical, solution; I was thinking to do a perl script that would understand both how to read an mbox and deliver to a new mbox...

Here is a shell below... now all I have to do is go through the pain of getting the Email CPAN module on my Solaris Zone... (Change imap to mbox...)

#!perl -w

use strict;
use Email::Folder;
use Email::LocalDelivery;

# copy all mail from an IMAP folder
my $folder = Email::Folder->new('/var/mail/bouncebacks'); # read INBOX
for ($folder->messages) {
if (/From:.*(@domain1.com)/i) { // Pseudo code
Email::LocalDelivery->deliver($_->as_string, 'domain1');
} elseif ( /From:.*(@domain2.com)/i ) {
Email::LocalDelivery->deliver($_->as_string, 'domain2');
}
}

1;
 
Actually, I think that yes, there would be. What you would want to do is insert your script in the delivery queue, like a content filter (e.g. spamassassin). Mail would come in on one port, be passed to your script, and then re-injected on another port. I mentioned spamassassin because I think the setup may work for your application. You should also be able to borrow a lot of the receipt and re-submit code from the SA application to facilitate writing your script.

I can think of two options: 1 - use your script as the delivery agent and have it put the message in the desired mbox/maildir, or have it change the recipient address and let the Postfix queue manger handle it.

One of the tricks is to configure the options on the resubmit port so that the content checks get bypassed - hence they apply to incoming mail only.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top