58 lines
1.2 KiB
Perl
58 lines
1.2 KiB
Perl
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE>Send me some email</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<H1>Send me some email!</H1>
|
||
|
<FORM METHOD="POST"
|
||
|
ACTION="email.cgi" ENCTYPE="application/x-www-form-urlencoded">
|
||
|
Please enter your email address: <INPUT TYPE="text" NAME="name" VALUE=""><P>
|
||
|
Please enter the email's subject:<INPUT TYPE="text" NAME="subject" VALUE=""><P>
|
||
|
Please enter the email you want to send: <P>
|
||
|
<TEXTAREA NAME="text">Dear you:</TEXTAREA>
|
||
|
<P>
|
||
|
<INPUT TYPE="submit" NAME="submit" VALUE="Send email">
|
||
|
<INPUT TYPE="reset">
|
||
|
</FORM>
|
||
|
</BODY>
|
||
|
</HTML>
|
||
|
|
||
|
|
||
|
#File: email.cgi
|
||
|
#!/usr/bin/perl
|
||
|
|
||
|
use CGI;
|
||
|
$co = new CGI;
|
||
|
print $co->header,
|
||
|
$co->start_html
|
||
|
(
|
||
|
-title=>'Email Example',
|
||
|
-author=>'your name',
|
||
|
-BGCOLOR=>'white',
|
||
|
-LINK=>'red'
|
||
|
);
|
||
|
|
||
|
if ($co->param()) {
|
||
|
$from = $co->param('name');
|
||
|
$from =~ s/@/\@/;
|
||
|
$subject = $co->param('subject');
|
||
|
$text = $co->param('text');
|
||
|
$text =~ s/</</g;
|
||
|
open(MAIL, '| /usr/lib/sendmail -t -oi');
|
||
|
print MAIL <<EOF;
|
||
|
To: yourname\@yourserver.com
|
||
|
From: $from
|
||
|
Subject: $subject
|
||
|
$text
|
||
|
EOF
|
||
|
close MAIL;
|
||
|
}
|
||
|
|
||
|
print
|
||
|
|
||
|
$co->center($co->h1('Thanks for sending me email!')),
|
||
|
|
||
|
$co->hr,
|
||
|
|
||
|
$co->end_html;
|