OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Adam Dennis (adamtcp.net.au)
Date: Wed Jan 23 2002 - 22:14:24 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Hell All,

    Newbie question here - been running postfix on Mac OS X Server for a
    few months now with much happiness and joy.

    Having trouble using vacation so I wanted to use virtual_maps and
    transport to pipe to an autoresponder script. Since I'm so useless at
    UN*X scripting does anyone out here have a handy HOWTO please??

    I got the stuff below from searching the list archives and I'd like
    to use it but perl and I are still in the "getting to know you" stage.

    thanks in advance - adam

    >----------------------------------------------------------------------
    >
    >When a user goes on vacation, add usernameautoreply.domain.com
    >to their address forwarding, for example:
    >
    >/etc/postfix/main.cf:
    > virtual_maps = hash:/etc/postfix/virtual
    >
    >/etc/postfix/virtual:
    > userdomain.com userautoreply.domain.com userdomain.com
    >
    >This will send the mail to the user as usual (virtual domain or
    >not), but will also send a copy of every message to an identical
    >address in the autoreply subdomain.
    >
    >To process the autoreplies, use a pipe-driven script that processes
    >recipients one at a time:
    >
    >/etc/postfix/main.cf:
    > transport_maps = hash:/etc/postfix/transport
    > autoreply_destination_recipient_limit = 1
    >
    >/etc/postfix/transport:
    > autoreply.domain.com autoreply:
    >
    >/etc/postfix/master.cf:
    > autoreply .... pipe user=foo argv=/some/where/autoreply $sender $user
    >
    >The autoreply script checks the sender address and the message headers.
    >The script should NEVER send an autoreply when:
    >
    > sender is owner-whatever or whatever-request (mailing list mail)
    > user is not listed in the To: or Cc: headers (mailing list mail)
    >
    >This is to prevent the autoresponder from replying to mailing lists.
    >
    >The script should set the envelope address to the null string, in
    >order to prevent autoreply mailer loops.
    >
    >Be careful: the autoreply script processes data from an untrusted
    >source. Don't let it near a shell. For example, use PERL code like:
    >
    > $SENDMAIL = "/usr/sbin/sendmail"
    >
    > open(MAIL, "|$SENDMAIL -f '' -t") || die "Cannot execute $SENDMAIL:
    >$!\n";
    > print MAIL <<EOF
    > From: MAILER-DAEMON (Automatic reply service)
    > To: $sender
    > Subject: $user is away from the mail
    >
    > Some other text here.
    > EOF
    > close MAIL || die "$SENDMAIL failed: $!\n";
    > exit 0;
    >
    >----------------------------------------------------------------------------

    -
    To unsubscribe, send mail to majordomopostfix.org with content
    (not subject): unsubscribe postfix-users