#!/usr/bin/perl # # # 17-Dec-99 amo Modified from Tools/new-list # 07-Oct-01 amo Write email header info to $DB_Dir # 08-Oct-01 amo Added date info into onlne rsvp and merged with email rsvp ( new-list ) # 15-Oct-01 amo Moved /usr/local/majordomo to /home/majordomo # # # $Source: /sources/cvsrepos/majordomo/contrib/new-list,v $ # $Revision: 1.14 $ # $Date: 1996/12/09 16:50:45 $ # $Author: cwilson $ # $State: Exp $ # # $Locker: $ # set our path explicitly $ENV{'PATH'} = "/bin:/usr/bin:/usr/ucb"; # Read and execute the .cf file $cf = $ENV{"MAJORDOMO_CF"} || "/etc/majordomo.cf"; if ($ARGV[0] eq "-C") { $cf = $ARGV[1]; shift(@ARGV); shift(@ARGV); } if (! -r $cf) { die("$cf not readable; stopped"); } require "$cf"; chdir($homedir) || die("Can't chdir(\"$homedir\"): $!"); unshift(@INC, $homedir); require "majordomo.pl"; require "shlock.pl"; &ParseMailHeader(STDIN, *hdrs); $reply_to = &RetMailAddr(*hdrs); $reply_to = join(", ", &ParseAddrs($reply_to)); die("new-list: $reply_to is not a valid return address.\n") if (! &valid_addr($reply_to)); $in_reply_to = $hdrs{"message-id"} . ", from " . $hdrs{"from"}; # # 08-Dec-99 amo Modified from Tools/new-list # 09-Oct-01 amo Added -db option for writing to $DB_Dir # # new-list info List.domain/info.info [ -db] # new-list rsvp List.domain/rsvp.info [ -db] # new-list map List.domain/map.info [ -db] # $list = $ARGV[0]; $Lst = $ARGV[1]; # 08-Dec-99 the File to send # # 07-Oct-01 amo Write email header info to $DB_Dir # $DB = $ARGV[2]; # # chgrp mail RSVP # chgrp mail RSVP/*.rsvp.txt # $DB_Dir = "/home/httpd/htdocs/RSVP/2001_11.rsvp.txt"; # ---------------------------------------------------------------------------------- # # remember who asked for automated emails...check permissions of the Log.info file # --------------------------------------- # planet:/usr/test/majordomo-1.94# la Log.info # -rw-rw---- 1 majordom daemon 51 Dec 17 03:14 Log.info # # # For time-stamping the log file # require "ctime.pl"; chop ( $ts = &ctime ( time ) ); # $info = "/home/majordomo/Log.info"; # open ( LH, ">> $info" ) || die "new-list: ERROR: Could not open $info..\n"; # # append the current data to the log file print LH "$ts $list\@$whereami $reply_to\n"; # # -------------------------------------------- # Define all of the mailer properties: # It is possible that one or both of $sendmail_command and $bounce_mailer # are not defined, so we provide reasonable defaults. $sendmail_command = "/usr/lib/sendmail" unless defined $sendmail_command; $bounce_mailer = "$sendmail_command -f\$sender -t" unless defined $bounce_mailer; $sender = "$list-approval"; $mailcmd = eval qq/"$bounce_mailer"/; # # 08-Dec-99 amo from majordomo-1.93 # open(MAIL, "|-") || &do_exec_sendmail(split(' ', "/usr/lib/sendmail -f$list-approval -t")); # # 08-Dec-99 amo Remove Generic Messages # # # if (defined($isParent = open(MAIL, "|-"))) { # &do_exec_sendmail(split(' ', $mailcmd)) # unless $isParent; # } else { # &abort("Failed to fork prior to mailer exec"); # } # # # print MAIL <<"EOM"; # To: $reply_to # Cc: $list-approval # From: $list-approval # Subject: Your mail to $list\@$whereami # In-Reply-To: $in_reply_to # Reply-To: $list-approval\@$whereami # # This pre-recorded message is being sent in response to your recent # email to $list\@$whereami. # # If you were trying to subscribe to the list, please send your request # to $whoami, not to $list\@$whereami. # # This is a new list. Your message is being returned unsent, but please # hold on to it. After a few days, when the flood of subscription # requests has died down somewhat, the owner of the list will announce # that the list is "open for business"; you should resubmit your posting # then. This way, everybody who joins the list within the first few days # of its existence starts out on an even footing, and we don't end up # with every other message asking "what did I miss?". # # Here's your original, unsent message: # # EOM # ; # ------------------------------------------------------------- # ------------------------------------------------------------- # # 08-Dec-99 amo Send these *.info messages based on virtual domains # print MAIL <<"EOM"; To: $reply_to Cc: $list-approval From: $list-approval Subject: Automated Response From $list\@$whereami In-Reply-To: $in_reply_to Reply-To: $list-approval\@$whereami EOM # # Attach my automated response # ---------------------------- # $file = "/home/majordomo/$Lst"; open ( FH, "< $file" ) || die "new-list: ERROR: Could not open $file..\n"; while ( ) { print MAIL $_; } close ( FH ); # --------------------------------------------------- # print MAIL "\nHere's your original message:\n\n"; # # # 07-Oct-01 amo Write email header info to $DB_Dir # &create_db_entry if ( $DB eq "-db" ); # # foreach ("From", "To", "Cc", "Subject", "Date", "Message-ID") { ($hdr = $_) =~ tr/A-Z/a-z/; if (defined($hdrs{$hdr})) { print MAIL "> $_", ": ", $hdrs{$hdr}, "\n"; } } print MAIL "\n"; while () { print MAIL "> $_"; } close(MAIL); exit 0; # # 07-Oct-01 amo Write email header info to $DB_Dir # # Create a Database Entry # ----------------------- # sub create_db_entry { # my ( $date ) = "$hdrs{'date'}"; # Tue, 9 Oct 2001 04:25:44 -0700 $date =~ s/-0700// ; # my ( $from ) = "$hdrs{'from'}"; # "Web Master " $from =~ s/\//; # ( @f ) = split ( /\s+/, $from ); $email = $f[$#f]; # # $from =~ s/$email//; # # # mail group needs to be able to write into DB_Dir # -- assume "1" for number of rsvp # ` echo "$date 1\t$email\t $from" >> $DB_Dir `; # } # create_entry # # # end of file