Hi Postfix-Experts,

I have the need to activate an autoresponder in my postfix server. From the
postfix pages i found the package "autoresponse" very appealing and
convinient.

Installing and hooking into postfix via postfix pipe command (using exactly
the instructions from the autoresponse homepage) went well. Also the admin
functions (set an autoresponse, clear an autoresponse, blah, ...) works
fine.

Autoresponding works fine in MOST cases, but sadly not in all. I have no
idea and see no rule why some email addresses work and some not.

I digged the problem down and saw (with some traceprints in the autoresponse
script) that the incoming mail is forwarded to autoresponse correctly, but
somehow in some circumstances the "original_recipient" address is truncated
by the TLD part.

Meaning, autoresponse script only gets "myn...@mydomain" instead of the
correct "myn...@mydomain.de" from postfix. The TLD is missing here. That
happens, already said, not with all but some addresses (with no rule at the
moment i can see). But it happens always with the same addresses. That
means, IF an address gets transferred truncated from postfix to autoresponse
script, it will happen EVERY TIME with that address. While an address that
works, will work also all the time.

I must use "original_recipient" (not "recipient") in master.cf, as i do some
rewriting with aliases to match local linux user accounts with external
email addresses. E.g.

        1. Incoming Mail to myn...@mydomain.de
        2. Postfix virtual domains rewrite like: myname         j...@m15
           (jt is my local unix login and m15 the hostname)
      3. Delivery local to ~/users/jt/Maildir/

I want to keep the original destination to see later in my MUA to which
address the mail belongs.

I can see in the logfile, that postfix first picks up the email with the
correct (full) recipient address, then delivers it to autoresponse and clean
up. At this point autoresponse already got the truncated version of the
email address.

Then autoresponse generates a new mail (by sendmail command) to deliver the
mail to the local users inbox using the (now truncated) address, after
checking if an autoresponse for that address have been set (and also
generates a mail back to the sender if so). This also shows up in the
logfile (the maybe generated autoresponse mail to sender and the forwarded
original message to original_recipient).

The problem is now, that with the missing TLD (in case it happens) postfix
have no idea where to deliver the generated mail by autoresponse, asks my
DNS and gets a "non exist" answer (what is correct, as this domain - without
the TLD - does not exist).

So postfix reacts as expected and the sender gets an "undeliverable" mail
from my mailer-daemon and the mail is not delievered to the recipient. :(

I thought i would be smart and do a small workaround. Changing autoresponse
script, so that a small Perl script is called from autoresponse bash script
that checks for the existence of a valid TLD in the recipient address. That
works fine when i test it within a shell. But when i hook that adapted
autoresponse script into postfix i get a "can't redirect stream" message in
the logfile and postfix goes crazy, stopping delivering anything. :(

I need to redirect stdout from my Perl script to autoresponse bash script,
to receive the (maybe) changed recipient address (maybe a TLD added) back
into my autoresponse script.

Now i'm completely out of ideas. So i sadly have to bother you with the
following questions:

- Does anyone have an idea/hint for me why some addresses loose the TLD part
when transmitted from postfix pipe feature to autoresponse bash script and
how i can solve this? (Best way to solve of course).

- If that is not clear/possible, can anyone enlighten me how i can pass a
variable from bash script to my Perl script and maybe change the value in
Perl script and passing back either the original (unchanged) value or a
changed one other way as do a print command in Perl and redirect stdout?

- Or how i can redirect stdout when my script runs under postfix pipe
feature without complaints from postfix?

- or someone can recommend another package like autoresponse, that works and
have comparable features as autoresponse?

Sorry for the long mail, but i think i need to explain in full detail to be
understandable. If you have any further questions, please ask. I was unsure
if i shall add some logfile information to my first mail (it is already much
too long :( ), but will do gladly if you need them and request for it.

Thank you all for reading and your effort and maybe a shed of light in my
dark brain. 

TIAVM
Joerg

Reply via email to