#!/usr/bin/perl -w $PSSWD = 'foo'; # Type in your program access password here! =pod AUTHOR Tommy Butler phone: (817)-468-7716 6711 Forest Park Dr Arlington, TX 76001-8403 COPYRIGHT Tommy Butler, all rights reserved. LISCENCE This library is free software, you may redistribute and/or modify it under the same terms as Perl itself. INSTALLATION (3 easy steps) All non-standard modules used in this script may be found in the ooOPps Open Source Code Library under its "modules" section. Note that some modules use others. The ooOPps Code Library is at 1. Place this script in your cgi bin directory. 2. Change permissions on this script to 755 on linux/unix systems by using your FTP client software, or from a command line shell by typing the following command after entering the directory where this script is located: chmod -v 755 [ script name ] 3. Create a subdirectory inside your cgi-bin directory named 'modules' and place the modules used by this script into that directory. Create subdirectories within it according to the modules used in this program. Refer to the itemized list below for more specific information: "Mailer::Simple" used by: This program file name: Simple.pm directory: modules/Mailer/ get it at: /pub/modules/Mailer/Simple.pm "Handy::Dandy" used by: This program file name Dandy.pm directory: modules/Handy/ get it at: /pub/modules/Handy/Dandy.pm "OOorNo" used by: Handy::Dandy file name: OOorNo.pm directory: modules/ get it at: /pub/modules/OOorNo.pm "Handy::Dandy::TimeTools" used by: Handy::Dandy file name: TimeTools.pm directory: modules/Handy/Dandy get it at: /pub/modules/Handy/Dandy/TimeTools.pm =cut ++$|; require 5.6.0; use vars qw( $PSSWD ); use strict; use lib './modules'; use CGI qw( header param ); use Mailer::Simple; use Handy::Dandy 'html_escape'; my($cgi) = CGI->new(); my($mailman) = Mailer::Simple->new(); print(header, &email_form) and exit unless param('message'); print(header, error('Invalid Password.')) and exit if (param('password') ne $PSSWD); my($eml) = { # defaults to 'text/plain', but you can set it to 'text/html' if you # want to send an email in formatted html by assigning a value of # 'text/html' to this argument 'contype' => param('contype'), # email address for the sender of this message 'from' => mail_field(param('from name'),param('from')), # the email address at which you wish receive replies to this message 'reply to' => mail_field(param('reply to'),param('reply to name')), # email address for the recipient of this message 'to' => mail_field(param('to name'),param('to')), # you can specify an email address of someone to whom you wish to # direct a 'carbon copy' of the email. 'cc' => mail_field(param('cc name'),param('cc')), # you can specify an email address of someone to whom you wish to # direct a 'blind carbon copy' of the email. 'bcc' => mail_field(param('bcc name'),param('bcc')), # subject of the message 'subject' => param('subject'), # message body 'message' => param('message'), # the number of columns at which to wrap plain-text email. # defaults to a value of '80' 'wrap at' => param('wrap at'), }; $mailman->mail(%$eml); map { $eml->{ $_ } = html_escape($eml->{ $_ }) } keys(%$eml); print(header, mail_sent($eml)); # -------------------------------------------------------- # subroutine declarations # -------------------------------------------------------- sub mail_field { $_[0] && $_[1] ? qq["${\$_[0]}" <${\$_[1]}>] : '' } sub email_form { <<__HTML__ } Mailman
 
the Mailman
 
password  
recipient's name  
recipient's email  
sender's name  
sender's email  
reply to name  
reply to email  
CC name  
CC email  
BCC name  
BCC email  
subject  
content-type   html   plain-text  

message
 

send message  

 

__HTML__ sub mail_sent { <<__SENT__ } Error
 
the Mailman
 
recipient   ${\($_[0]->{'to'}||'')}
sender   ${\($_[0]->{'from'}||'')}
reply-to   ${\($_[0]->{'reply to'}||'')}
CC   ${\($_[0]->{'cc'}||'')}
BCC   ${\($_[0]->{'bcc'}||'')}
subject   ${\($_[0]->{'subject'}||'')}
content-type   ${\($_[0]->{'contype'}||'')}

message
 
${\($_[0]->{'message'}||'')}

 

__SENT__ sub error { <<__ERR__ } Error

 

An error has occurred.
 
@_

 

__ERR__