[Mailman-Users] Re: Posting to list via mailman archives
Paul H Byerly
paul at thcwd.com
Mon Jun 2 18:57:59 CEST 2003
Steve wrote:
>I'm wondering if anyone has ever set up their mailman archives so
>that people can reply to list messages directly from the web page. I
>know it would be trivial to add a mailto link to the list address on
>the archive html pages, but I'm thinking more like some sort of
>script that would not use mailto -- instead it would provide a text
>edit box to the user, and when they clicked "send" a well-formed mail
>would be sent to the list address, with the appropriate subject line,
>correct headers, etc.
I'm working on it and am part way there. I'm using Matt's formmail
script <http://www.scriptarchive.com/formmail.html>. The script is set to
only accept mail to my server, so I think it's secure.
I have private archives, and I pick up the users e-mail with a cookie
when they log in. The mail is sent with that e-mail address, so it shows
from them on the list, and it is moderated or not depending on how the
individual e-mail is flagged.
I have not had a chance to dig into it, but I think the subject and
quote can be done with information available from mailman.
To start with you want Richard Barrett's patch
<http://sourceforge.net/tracker/?func=detail&aid=730769&group_id=103&atid=100103Richard>
that allows you to use modified templates
in $prefix/lists/<listname>/<language>/
Below is what I have in the private.html file. This grabs the user
e-mail when they log in:
---------------
<html>
<head>
<title>%(realname)s Private Archives Authentication</title>
<SCRIPT LANGUAGE=JAVASCRIPT>
expireDate = new Date
expireDate.setYear(expireDate.getYear()+1)
userName = ""
if (document.cookie != "") {
userName = document.cookie.split("=")[1]
}
function setCookie() {
userName = document.myForm.username.value
document.cookie = "userName="+userName+";expires=" +
expireDate.toGMTString()
}
</SCRIPT>
</head>
<body bgcolor="#ffffff">
<FORM NAME=myForm METHOD=POST ACTION="%(action)s/">
%(message)s
<TABLE WIDTH="100%%" BORDER="0" CELLSPACING="4" CELLPADDING="5">
<TR>
<TD COLSPAN="2" WIDTH="100%%" BGCOLOR="#99CCFF" ALIGN="CENTER">
<B><FONT COLOR="#000000" SIZE="+1">%(realname)s Private
Archives Authentication</FONT></B>
</TD>
</TR>
<tr>
<TD><div ALIGN="Right">Email address:</div></TD>
<TD><INPUT TYPE="text" value="enter e-mail here" name=username
onBlur="setCookie()"></TD>
</tr>
<tr>
<TD><div ALIGN="Right">Password:</div></TD>
<TD><INPUT TYPE="password" NAME="password" SIZE="30"></TD>
</tr>
<tr>
<td colspan=2 align="middle"><INPUT type="SUBMIT"
name="submit"
value="Let me in...">
</td>
</tr>
</TABLE>
<p><strong><em>Important:</em></strong> From this point on, you
must have cookies enabled in your browser, otherwise no
administrative changes will take effect.
<p>Session cookies are used in Mailman's
administrative interface so that you don't need to
re-authenticate with every administrative operation. This
cookie will expire automatically when you exit your browser, or
you can explicitly expire the cookie by hitting the
<em>Logout</em> link under <em>Other Administrative
Activities</em> (which you'll see once you successfully log in).
</FORM>
</body>
</html>
---------------
Copy article.html from templates into
$prefix/lists/<listname>/<language>/ and make what ever changes you want
to add a link to the posting form on the bottom of each archived post. I did:
<a href="/mailman/private/<listname>/webpost.shtml">Reply</a>
Then in $prefix/archives/private/<listname> I have the following
webpost.shtml:
------------------
<HTML>
<HEAD>
<SCRIPT LANGUAGE=JAVASCRIPT>
eMail = (document.cookie.split("=")[1]).split(";")[0]
if (document.cookie != "") {
document.write("You are logged in as: "+ eMail)
}
function delCookie () {
if (document.cookie !="") {
if (confirm("Do you want to delete the cookies?")) {
thisCookie = document.cookie.split(";")
expireDate = new Date
expireDate.setYear(expireDate.getYear()-1)
for (i=0; i<thisCookie.length; i++) {
cookieName = thisCookie[i].split("=")[0]
document.cookie = cookieName + "=;expires=" + expireDate.toGMTString()
}
document.write ("<H1>Number of cookies deleted: " + thisCookie.length
+ "</H1>")
}
}
}
function fillForm () {
document.theForm.email.value = eMail
}
</SCRIPT>
<TITLE>Web Posting Form</TITLE>
</HEAD>
<body>
<P ALIGN=Center>
<p align="center"><a href="#" onClick="delCookie()">Click here to log out.</a>
<BR><BR>
<P ALIGN=Center>
<CENTER>
<br>
Post from web form for Mailman.<br>
<br>
<BR>
</CENTER>
<CENTER>
<TABLE CELLPADDING="2" ALIGN="Center" WIDTH="90%">
<TR>
<TD> This form now takes the "from" e-mail from a
cookie that is formed when the e-mail and password
are entered!!
<P ALIGN=Left>
<FORM NAME=theForm ACTION = "http://SERVER
NAME/cgi-bin/FormMail.pl" METHOD = "POST">
<INPUT type=hidden name="recipient" value="LIST ADDRESS">
<INPUT type=hidden name="redirect" value="URL OF PAGE TO GO TO
AFTER POST IS SENT">
<INPUT type=hidden name="email" value="">
Subject:
<INPUT type=text name="subject" value="">
<BR>
Content:<BR>
<TEXTAREA NAME="-" ROWS="16" COLS="60"
onBlur="fillForm()"></TEXTAREA><BR>
<INPUT TYPE=reset value="Reset">
<INPUT TYPE=submit value="SEND IT!">
</FORM>
</TD>
</TR>
</TABLE>
</CENTER>
<P>
<BIG><BR>
<BR>
</BIG><BR>
</BODY></HTML>
-------------
This is rough, and still has some working notes imbedded in it, but
it should get you going. Contact me off list if you need to. And if you
have any ideas on picking up subject and quote let me know.
<>< Paul
More information about the Mailman-Users
mailing list