Hmm. Well, you could set up a .qmail-default file in xyz's directory that
has this:

| find_and_forward.pl

where find_and_forward.pl is your perl script that dynamically finds the
forward address for xyz. Then in order to actually forward the message just
read <> into a variable (say, $message) and inject that into qmail with
qmail-inject which, in perl, would look something like this:

        $mail_prog = '/var/qmail/bin/qmail-inject';

        $mail =  "To: $to_name <$to_email>\r\n";
        $mail .= "From: $from_name <$from_email>\r\n";
        $mail .= "Subject: $subject\r\n\r\n";
        $mail .= "$message\r\n";

        system ("echo '$mail' | $mail_prog");

Obviously the $to_email came from your SQL database search and you can
either parse the message for the $subject or fudge your own. Better methods
than this? I'm sure there are several but this is what immediately comes to
mind.

Brett.



-----Original Message-----
From: Kim Chr. Hvidkjaer [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 10:38 AM
To: [EMAIL PROTECTED]
Subject: forwarding to a dynamic / variable address ??


Hello All,

I'm trying to do a forwaring-service, where the users each have an address
(ie [EMAIL PROTECTED]) and any mail sent to this address is forwarded to their
_actual_ address (perhaps a hotmail-address or similiar).

I know how to forward (& [EMAIL PROTECTED]) but how do I do it dynamically? I
can do a php or perl-script that will digg out the needed to-address from my
mySql-database, but don't know how to do the actual forwarding??

any help is greatly appriciated!!!!!




(I've subscribed to the list, but am not getting any mail yet, so please cc:
[EMAIL PROTECTED])

// Kim

[EMAIL PROTECTED]


Reply via email to