Redirect email bounces

Discussion in 'Server Operation' started by ophthal, Mar 12, 2018.

  1. ophthal

    ophthal New Member

    I have a multi-server set-up with one server processing mail for multiple domains using postfix/Courier/Maildrop.
    For one of the domains (eg. mydomain.com) I send out emails for clients (eg. [email protected]) using the "From:" format [email protected].

    When one of these messages bounces, it goes to a catchall mailbox and I know where to forward it to from the local-part, and have been doing it manually.
    How can I auto-redirect these to the client?
    I assume I need to pipe the email to a php script, parse the local part and send it out?
    Can I get some pointers please on how to do this in ispconfig3 to get me started.
    Thanks,
    Ray
     
  2. ophthal

    ophthal New Member

    For others who might find this through a generic search, here's what I learned from SO and is working now:
    Mail Content Filter
    Server: **select your mail server**
    Filter: Header Filter
    Regexp. Pattern: /^To: (.*)_XYZ_(.*)@mydomain.com$/
    DATA: ${1}@${2}
    ACTION: REDIRECT
    and check the Active box and Save.
    I'm sure there is a better Regex to match all possibilities for the To: header but this is working for me so far.
    I did not need to pipe it to a php/perl script or to procmailrc or use aliases.
    A couple of questions: does this Content Filter happen before or after rbl checks etc?
    I may need to find another solution if this is potentially opening a backdoor for relays.
     

Share This Page