NAME
CGI::ContactForm - Perl extension for generating a web contact form
SYNOPSIS
use CGI::ContactForm;
contactform (
recname => 'John Smith',
recmail => 'john.smith@domain.com',
smtp => 'smtp.domain.com',
styleurl => '/style/ContactForm.css',
);
DESCRIPTION
This module generates a contact form for the web when the routine contactform()
is called from a CGI script. Arguments are passed to the module as a list of key/value pairs.
CGI::ContactForm
sends a well formated (plain text format=flowed in accordance with RFC 2646) email message, with the sender's address in the From:
header, and the sender gets a bcc
copy. If the email address stated by the sender is invalid, the failure message is sent to the recipient address, through which you know that you don't need to bother with a reply, at least not to that address...
Arguments
CGI::ContactForm
takes the following arguments:
Default value
=============
Compulsory
----------
recname (none)
recmail (none)
smtp (none)
Optional
--------
styleurl (none)
returnlinktext 'Main Page'
returnlinkurl '/'
maxsize 100 (KiB)
Additional arguments, intended for forms at non-English sites
-------------------------------------------------------------
title 'Send email to'
name 'Your name:'
email 'Your email:'
subject 'Subject:'
message 'Message:'
reset 'Reset'
send 'Send'
erroralert 'Fields with %s need to be filled or corrected.'
marked 'marked labels'
thanks 'Thanks for your message!'
sent_to 'The message was sent to %s with a copy to %s.'
encoding 'iso-8859-1'
INSTALLATION
Installation with Makefile.PL
Type the following:
perl Makefile.PL
make
make test
make install
Manual Installation
Download the distribution file and extract the contents.
Designate a directory as your local library for Perl modules, for instance
/www/username/cgi-bin/lib
Create the directory
/www/username/cgi-bin/lib/CGI
, and uploadContactForm.pm
to that directory.In the CGI scripts that use this module, include a line that tells Perl to look for modules also in your local library, such as
use lib '/www/username/cgi-bin/lib';
DEPENDENCIES
CGI::ContactForm
requires these modules, available at CPAN:
Mail::Sender
Text::Flowed
It also requires direct access to an SMTP server.
If Mail::Sender
and Text::Flowed
need to be installed manually, you shall create /www/username/cgi-bin/lib/Mail
and /www/username/cgi-bin/lib/Text
and upload Sender.pm
respective Flowed.pm
to those directories.
EXAMPLES
An example CGI script (contact.pl
) and a style sheet (ContactForm.css
) are included in the distribution. Note that the style sheet typically needs to be located somewhere outside the cgi-bin.
VERSION HISTORY
- v1.03 (Mar 30, 2003)
-
CGI.pm used for parsing form data.
New argument: 'maxsize' - for limiting the message size.
- v1.02 (Feb 16, 2003)
-
DOCTYPE declaration changed to XHTML 1.1.
- v1.01 (Feb 13, 2003)
-
CSS validation error corrected.
- v1.0 (Feb 12, 2003)
-
Additional arguments added that makes it possible to have the form display non-English text.
Warnings enabled.
- v0.4 (Feb 9, 2003)
-
Error alert message added. Also
ContactForm.css
was modified for this reason.Simple test script included in the distribution.
- v0.3 (Feb 7, 2003)
-
Check of email syntax modified (hopefully now closer to RFC 822).
Better structured code.
- v0.2 (Feb 5, 2003)
-
Referer check in order to only accept data input from the generated form.
Improved email validation.
- v0.1 (Feb 3, 2003)
-
Initial release.
LATEST VERSION
The latest version of CGI::ContactForm
is available at:
http://search.cpan.org/author/GUNNAR/
http://www.gunnar.cc/contactform/
AUTHOR, COPYRIGHT AND LICENSE
Copyright © 2003 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.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 184:
Non-ASCII character seen before =encoding in '©'. Assuming CP1252