Skip to content

Instantly share code, notes, and snippets.

@nikdoof
Created July 12, 2020 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikdoof/8235de469d78a00cfb770e4dd0ed1738 to your computer and use it in GitHub Desktop.
Save nikdoof/8235de469d78a00cfb770e4dd0ed1738 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/perl
# Basic mailer/bug report perl
# Copyright argh@dimension.spodnet.uk.com 1999
require "cgi-lib.pl";
# change this to the location of sendmail on your system
# this should be standard for linux
$SENDMAIL = "/usr/lib/sendmail -t";
# change this to the recipient
$RECIPIENT = 'argh@dimension.spodnet.uk.com';
print "Content-type: text/html\n\n";
print "<html>\n";
print "<head>\n";
# read all the inputted stuff from the form and shove them into
# a string called 'values'
&ReadParse(*values);
#Use the information
#check to see if all the fields are there
if ((! $values{"name"}) ||
(! $values{"email"}) ||
(! $values{"comments"}) ||
($values{"comments"} eq "TYPE COMMENT HERE"))
{
print "<title>Please fill out all the fields</title>\n";
print "</head>\n";
print "<h1>Please fill out all the fields</h1>\n";
print "Please fill out the name, email address, comments\n";
print "Back up to the previous page to try again.\n";
print "</body></html>\n";
exit 0;
}
#everything chesk okay mail it!
$fname = "|" . $SENDMAIL;
open(OUT, $fname);
print OUT "To: ", $RECIPIENT, "\n";
print OUT "From: ", $values{"name"}, " <", $values{"email"}, ">\n";
print OUT "Subject: comments/bug report\n";
print OUT "\n";
print OUT $values{"comments"}, "\n";
print OUT "--\n\n";
print OUT "System: ", $values{"system"}, "\n";
print OUT "Version: ", $values{"version"}, "\n";
print OUT $values{"bug"}, "\n";
close(OUT);
print "<title>Thank you, ", $values{"name"}, "</title>\n";
print "</head>\n";
print "<h1>Thank you, ", $values{"name"}, "</h1>\n";
print "Thank you for your report.\n";
print "</body></html>\n";
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment