Mailform - Create E-mail input form and send E-mail to recipient |
Mailform - Create E-mail input form and send E-mail to recipient
$Id: Mailform.pm,v 1.3 2002/11/04 14:16:31 t_shigetome Exp $
use CGI; use Mailform; my(%config) = ( 'subject' => 'No subject', 'redirect' => 'mailtest.txt', # It's for debug 'sendmail' => ['/usr/lib/sendmail -n -t -oi'], 'nexturl' => 'index.html', ); my(%recipient) = ( 'Someone' => 'someone@anywhere.com', 'Anotherone' => 'Anotherone@anywhere.com', 'Each' => 'Someone;Anotherone', 'All' => 'Someone;Anotherone;boss@anywhere.com', ); my($form) = new Mailform($ENV{'REQUEST_URI'}); $form->ParseQuery(); $form->SetParameter(\%config, \%recipient); $form->OutResponse();
This is for CGI program. Generate E-mail send form. Posted message will be send to selected receiver. Support base64 encoding for unsafe character in subject and name. This form support only Japanese Kanji code like as Shift-JIS.
my($form) = new Mailform($ENV{'REQUEST_URI'});
SetParameter($filename)
or SetParameter($rh_para, $rh_alias)The $rh_para and $rh_alias are hash reference of parameter. See following description for parameters. The $rh_alias is hash refrence of recipient list. If you want to assign two or more receivers to one alias, you can describe separated each one `;'.
sub SendMail
.
Refer following sample source to use parameter file.
sample.cgi
use CGI; use Mailform; my($form) = new Mailform($ENV{'REQUEST_URI'}); $form->ParseQuery(); $main::configname = $form->config(); $form->SetParameter("sample.par"); $form->OutResponse();
sample.par
#if $main::configname eq 'test' # define CONFIG test #endif %CONFIG% redirect{ testmail.txt; }; %CONFIG% subject{ default subject }; %CONFIG% nexturl{ /~yahoo/index.html; }; recipient foo{ foo@anywhere.com; }; recipient ya{ ya@anytime.com; }; recipient all{ ya; foo; };
ParseQuery()
OutResponse()
SetTemplate($templatefile)
sub GetTemplate
.
See also InputFormTemplateFile
InputFormTemplateFile($filename)
sub GetFormTemplate
.
debug($debug_opt)
$form->debug('configpara'); $form->debug('query_string'); $form->debug('alias'); $form->debug('template'); $form->debug('sendmail');
Message of debugging will be outputted to STDERR. Also. you can log by redirect STDERR with debuglog.pl or other.
When you terminate debugging, you can strip debugging code from this module. All of debugging code are between line of `#>>>DEBUG_CODE'. These are able to strip by striper.pl.
Params.pm, CGI.pm, MIME::Base64.pm, jcode.pl
Tetsuya Shigetome, <t_shigetome@muf.biglobe.ne.jp>.
o Change comments
o Change manual to english.
o Change to Params.pm from loadparaex.pl And add hash reference arguments to SetParameter.
Mailform - Create E-mail input form and send E-mail to recipient |