Great Circle Associates Majordomo-Users
(November 2000)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Re: Creating URL for subscribing
From: Dan Liston <dliston @ netscape . com>
Organization: iPlanet E-Commerce Solutions, A Sun Netscape Alliance
Date: Thu, 16 Nov 2000 17:12:49 -0600
To: John Poltorak <jp @ eyup . org>
Cc: majordomo-users @ GreatCircle . COM
References: <20001116163027.Y158@eyup.org>

Not possible out of the box, but with some good cgi or the attached 
perl script, you might get want you want to accomplish.

The perl script is self documented, so read it and follow the examples.
It allows you to set up aliases that will auto-complete the zubscribe
or unzubscribe requests for the users without them putting anything in
the subject or body of the message.  All they have to know is the right
address, and you provide that with the mailto: URL.

mailto:sample-list-subscribe@your.domain
mailto:sample-list-unsubscribe@your.domain

the aliases look like this.

sample-list-subscribe:  "|/path/to/majordomo/wrapper subscribe sample-list"
samplelist-unsubscribe: "|/path/to/majordomo/wrapper subscribe -u sample-list"

Dan Liston

John Poltorak wrote:
> 
> I've already tried posting this twice over the last couple of days
> but it never came back for some reason... Anyway here goes again...#
> 
> How do I go about creating a URL for subscribing to a mailing list?
> 
> Can I do something like:-
> 
> mailto:list123-request-subscribe@abc.xyz  ?
> 
> or do I need to include something in subject?
> 
> I'm not sure that this is possible at all with Majordomo,
> 
> but I find it to be a pain giving verbose instructions to people
> about how to join, and would rather people were able to click
> on a URL in my signature for instance...
> 
> If it is posible to do what I want, how do I set up the alias to
> invoke the subscribe command?
> 
> --
> John
#!/usr/bin/perl
# The above needs to be edited to match your system.

# $Revision: 0.1 $
# $Date: 2000/08/09 12:54:16 $
# $Author: dliston $
# Shamelessly borrowed/stolen from request-answer

# PATH is set in the wrapper, so there is no need to set it here.

# syntax:  wrapper subscribe [-u] listname
# where wrapper = fully qualified /path/to/majordomo/wrapper,
# subscribe = the name you saved this file as,
# [-u] = an optional "unsubscribe" modifier,
# and listname = the unqualified name of your mailing list.

# Any variables defined in majordomo.cf will not be defined here.

# Example aliases file entries:
# $list-subscribe:  "|/path/to/majordomo/wrapper subscribe $list"
# $list-unsubscribe: "|/path/to/majordomo/wrapper subscribe -u $list"

# Uncomment the $sender variable of your liking.  Just be sure you
# have an entry in aliases that matches the $sender that you chose.
# The default $sender, owner-$list fits sendmail systems perfectly.

# NOTE: your mailing $list should be configured with an open or auto 
# subscribe and unsubscribe policy for maximum script efficiency.

# 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 "shlock.pl";
require "majordomo.pl";

&ParseMailHeader(STDIN, *hdrs);
$reply_to = &RetMailAddr(*hdrs);
$reply_to = join(", ", &ParseAddrs($reply_to));

$zub_command = "subscribe";
$list = $ARGV[0];
if ($list eq "-u") {
    $zub_command = "unsubscribe";
    $list = $ARGV[1];
}

die("$zub_command: $reply_to is not a valid return address.\n") 
    if (! &valid_addr($reply_to));

# robots should not reply to other robots...
if ($reply_to =~ m/$majordomo_dont_reply/i) {
    &abort( "$whoami: not replying to $1 to avoid mail loop.\n");
}

$in_reply_to = $hdrs{"message-id"} . ", from " . $hdrs{"from"};

#$sender = "owner-$list\@$whereami";
$sender = "$list-owner\@$whereami";
#$sender = "$list-request\@$whereami";
#$sender = "$list-approval\@$whereami";

$mailcmd = eval qq/"$bounce_mailer"/;

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: $whoami
From: $reply_to
Subject: mail to $list-$zub_command\@$whereami
In-Reply-To: $in_reply_to

$zub_command $list $reply_to

EOM

close(MAIL);

exit 0;

References:
Indexed By Date Previous: Re: questions - third attempt!
From: Dan Liston <dliston@netscape.com>
Next: Re: archiving mail from mail lists
From: Dan Liston <dliston@netscape.com>
Indexed By Thread Previous: Re: Creating URL for subscribing
From: Carolyn Baird <cas@boronia.apana.org.au>
Next: Re: Creating URL for subscribing
From: Todd Lyons <todd@mrball.net>

Google
 
Search Internet Search www.greatcircle.com