A guestbook with Perl, CGI and email. whooo
This commit is contained in:
parent
edb6edb5b6
commit
5e5225a172
8 changed files with 68 additions and 5 deletions
32
pub/cgi-bin/guestbook.cgi
Executable file
32
pub/cgi-bin/guestbook.cgi
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use v5.26;
|
||||
use CGI::Minimal;
|
||||
|
||||
die if !$ENV{CONTENT_LENGTH};
|
||||
CGI::Minimal::max_read_size(128*1024);
|
||||
my $cgi = CGI::Minimal->new;
|
||||
die if $cgi->truncated;
|
||||
|
||||
open my $S, '|-', qw'/usr/sbin/sendmail -t -f dev@yorhel.nl' or die $!;
|
||||
printf $S <<'_', $cgi->param('name'), $cgi->param('message');
|
||||
To: dev@yorhel.nl
|
||||
From: dev@yorhel.nl
|
||||
Subject: Guestbook post
|
||||
Content-Type: text/plain; charset='UTF-8'
|
||||
|
||||
Name: %s
|
||||
|
||||
Message:
|
||||
|
||||
%s
|
||||
_
|
||||
close $S or die;
|
||||
|
||||
print <<'_';
|
||||
Status: 303
|
||||
Content-Type: text/plain
|
||||
Location: https://dev.yorhel.nl/guestbook/thanks
|
||||
|
||||
Redirecting...
|
||||
_
|
||||
Loading…
Add table
Add a link
Reference in a new issue