[lug] mail responders
John Hernandez
John.Hernandez at noaa.gov
Thu Apr 12 09:10:06 MDT 2001
If you need something fancier, you may be able to hack this:
http://www.hkstar.com/~west/perl98/html/aack.html
bdoctor at ps-ax.com wrote:
>
> I've included a script I use at the bottom -- not perfect or pretty but it works
> well.
>
> -brad
>
> >
> > anyone have a recommendation for a mail responder that *doesnt* rely on
> > procmail or a .forward file?
> >
> > i am really looking just to
> >
> > respond: "| /usr/local/bin/mailrespond.pl"
> >
> > but my perl is pretty weak.
> >
> >
> > _______________________________________________
> > Web Page: http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> >
>
> --------------
>
> #!/usr/local/bin/perl
> # $Source: /cvs/users/inform.pl,v $
> # $Revision: 1.3 $
> # $Date: 1999/02/11 20:40:59 $
> #
> # This software was designed and written by Brad Doctor (bdoctor at ps-ax.com)
> # Redistribution and use are permitted under the terms of the GNU Public
> # License.
>
> use strict;
> my $sendmail_BIN = "/usr/sbin/sendmail"; # where is sendmail?
> my $postmaster = "postmaster\@yourhost.com"; # define local postmaster
> my $subject = "User unknown"; # whatever the subject should be
> my $newdomain = ""; # user's new domain?
>
> use vars qw($from_holder $to_holder $subject_holder $null $From $To);
> use vars qw($person $message);
>
> while (<STDIN>) {
> chomp;
> if ( /From\ / ) {
> $from_holder = $_;
> } elsif ( /To\:\ / ) {
> $to_holder = $_;
> } elsif ( /Subject\:\ / ) {
> $subject_holder = $_;
> }
> }
> &inform_sender;
>
> sub inform_sender {
> $from_holder =~ (s/\ /\:/g);
> ($null,$From) = split(/\:/, $from_holder);
>
> ($null,$To) = split(/\:/, $to_holder);
> $To =~ (s/\ //g);
>
> ($person,$null) = split(/\@/, $To);
> $subject_holder =~ (s/Subject\:\ //g);
> #print "From:$From\nTo:$To\nSubj:$subject_holder\n";
>
> # change message to whatever is appropriate
> $message = "
>
> The address you are using is invalid.
>
> postmaster\@yourhost.com
> ";
>
> open (DELIVER, "| $sendmail_BIN -oi $From") ||
> die "Can't create output: $!\n";
> print DELIVER "
> To: $To
> From: $postmaster
> Subject: $subject_holder
>
> Notice: Invalid address
> ---------------------------------------
> ";
> print DELIVER $message;
> close DELIVER;
>
> }
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
More information about the LUG
mailing list