CGI::ContactForm::MHonArc - Contact the message authors in a MHonArc archive
use CGI::ContactForm; use CGI::ContactForm::MHonArc; my $msg = getmsgvalues(); contactform ( recname => $msg->{fromname}, recmail => $msg->{fromaddr}, styleurl => '/style/ContactForm.css', returnlinktext => 'Messages by Date', returnlinkurl => '/archive/maillist.html', subject => $msg->{subject}, bouncetosender => 1, );
This module makes it easy to use CGI::ContactForm for contacting the message authors in a mail archive that was created by the MHonArc Email-to-HTML converter. Out from the message ID and the path to the archive, it retrieves the necessary data from the archive database.
The converted messages are supposed to include an HTML form for the purpose, so you need to set one of the MHonArc page layout resources. This is an example:
<form action="/cgi-bin/mhacontact.pl" method="get"> <input type="hidden" name="msgid" value="$MSGID$"> <input type="hidden" name="outdir" value="$OUTDIR$"> <input type="submit" value="Contact Author"> </form>
The form controls shall be named msgid and outdir (case matters), and their values are set dynamically via the MHonArc $MSGID$ respective $OUTDIR$ resource variables when the messages are converted.
msgid
outdir
$MSGID$
$OUTDIR$
Note that it is a GET request that shall be submitted.
GET
The SYNOPSIS section above is an example of what the CGI script, here named mhacontact.pl, may contain. The getmsgvalues() function returns a reference to a hash with the keys fromname, fromaddr and subject, and the hash values are passed to CGI::ContactForm when the contactform() function is called.
SYNOPSIS
mhacontact.pl
getmsgvalues()
fromname
fromaddr
subject
contactform()
If the name of the archive database is not the default name, you need to pass the database name to CGI::ContactForm::MHonArc:
CGI::ContactForm::MHonArc
my $msg = getmsgvalues('myfilename'); my $msg = getmsgvalues('/absolute/path/to/myfilename');
If you pass the absolute pathname, the outdir control can be excluded from the HTML form.
The Return-Path message header controls where bounced messages are sent. By default, CGI::ContactForm sets the Return-Path to the recipient address. However, when sending messages to archived addresses, there is an obvious risk that they are no longer valid, and it makes more sense that possible bounces are sent to the sender address instead. That is accomplished by passing a true value to contactform() with the bouncetosender argument (see the SYNOPSIS example).
Return-Path
bouncetosender
Copyright (c) 2004-2006 Gunnar Hjalmarsson http://www.gunnar.cc/cgi-bin/contact.pl
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
CGI::ContactForm, MHonArc
To install CGI::ContactForm, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::ContactForm
CPAN shell
perl -MCPAN -e shell install CGI::ContactForm
For more information on module installation, please visit the detailed CPAN module installation guide.