> Next thing I > want to do is allow the users to subscribe to multiple lists > from one signup page. The reason is we don't want our > customers to have to go through more hoops just to get our > information! > > I see a couple questions on the list posted about this, but > no one appears to have been replied to yet. If this isn't > possible, please at least reply to let me know that! > > If there is a command-list email option, that would work, such as: > > [EMAIL PROTECTED] where the From info is > parsed to effect the signup. It's easy to write a perl form > to take an inputted email address and send to the subscribe address.
Since there seem to be no takers, here's what I'm doing currently. I wrote an HTML form and PERL script to send emails to the <listname>[EMAIL PROTECTED] address, with "subscribe" in the subject, which seems to do the trick. You can modify the form and script to accommodate any number of email lists. (Superflouous HTML formatting removed) HTML FORM: <form method="post" action="/cgi-bin/email_list_subscribe.pl"> Sign up for list1: <input name="list1" type="checkbox" value="list1name" checked> Sign up for list2: <input name="list2" type="checkbox" value="list2name" checked> Your Name (optional): <input type="text" name="user_name" size="40" maxlength="100"> E-mail Address: <input type="text" name="user_email" size="40" maxlength="100"> <input type="submit" name="doit" value="Subscribe to List1"> <input type="hidden" name="listtarget" value="subscribe"> <input type="hidden" name="acktitle" value="Thank you!<br>Your request has been received."> <input type="hidden" name="acktext" value="Click <a href=/>here</a> to return to the home page."> <input type="hidden" name="counter_file" value="subscribe_counter.txt"> </form> PERL SCRIPT TO HANDLE IT. #!/usr/bin/perl $root_dir = "/www/domain"; #location of qmail-inject on your system $mailer = '/var/qmail/bin/qmail-inject'; # If you're using sendmail, probably change this to /usr/lib/sendmail or something like that. $topfile="$root_dir/templates/top.html"; $bottomfile="$root_dir/templates/bottom.html"; $datapath = "$root_dir/data/list1/"; $counterpath = "$root_dir/data/list1_counters"; $end_message = <<"MESSAGE__"; <p>We have just sent you a message requesting your confirmation that you want to be added to our mailing list. This verifies that we have your correct e-mail address, and protects you from fraudulent subscription requests. Please read this email message and follow the instructions to complete the subscription process.</p> <p>Thank You for subscribing to these email services. If you ever have any questions regarding your subscription, please contact us at <a href="/email/"></a>.</p> MESSAGE__ $unsub_end_message = <<"MESSAGE__"; <p>We have just sent you a message requesting your confirmation that you want to be REMOVED from our mailing list. This verifies that we have your correct e-mail address, and protects you from fraudulent requests. Please read this email message and follow the instructions to complete the unsubscribe process.</p> <p>If you ever have any questions, please contact us at <a href="/email/"></a>.</p> MESSAGE__ # next line should be the domain name of your ezmlm server $maillisthost = 'lists.domain.com'; # list of characters that are OK in an email address $OK_EMAIL_ADDRESS_CHARS='-a-zA-Z0-9_.@'; $OK_NAME_CHARS='-a-zA-Z0-9_. '; # process the user's input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Uncomment for debugging purposes # print "Setting $name to $value<P>"; $FORM{$name} = $value; } $addcounter = $FORM{'counter_file'}; $addcounter =~ s/[\.\/]//g; $title = $FORM{'acktitle'}; $top = &Template("$topfile"); $bottom = &Template("$bottomfile"); print "Content-type: text/html\n\n"; if($FORM{list1}) { push @recipients, $FORM{enews}; } if($FORM{list2}) { push @recipients, $FORM{prod}; } # Send subscribe message foreach $myrecipient(@recipients) { $recipient = "[EMAIL PROTECTED]"; $recipient =~ s/[^$OK_EMAIL_ADDRESS_CHARS]/_/go; print "<!-- mailing to $recipient -->"; $email = $FORM{'user_email'}; $email =~ s/[^$OK_EMAIL_ADDRESS_CHARS]/_/go; $name = $FORM{'user_name'}; $name =~ s/[^$OK_NAME_CHARS]/_/go; print "<!-- from $email -->"; open (MAIL, "|$mailer -f$email $recipient") || die "Can't open $mailer!\n"; print MAIL "From: $name <$email>\n"; print MAIL "Subject: $FORM{listtarget}\n\n"; close (MAIL); } # HTML confirmation notice print "<html><head><title>$title</title>\n"; print "$top"; if ($FORM{listtarget} eq 'subscribe') { print $end_message; } else { print $unsub_end_message; } print "$bottom"; open (FILE, "<$counterpath/$addcounter"); $value = <FILE>; ++$value; close (FILE); open (FILE, ">$counterpath/$addcounter"); print FILE "$value"; close (FILE); sub Template { local(*FILE); # filehandle local($file); # file path local($HTML); # HTML data $file = $_[0] || die "Template : No template file specified\n"; open(FILE, "<$file") || die "template : couldn't open $file : $!\n"; while (<FILE>) { $HTML .= $_; } close(FILE); $HTML =~ s/\$(\w+)/${$1}/g; $HTML =~ s/\$@(\w+)/${$1}/g; return $HTML; } ---------------------------------------------- -- Russell Mann ------------------------------------------------------ Mailman-Users mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/