Created
July 20, 2015 11:58
-
-
Save tonyvu2014/0b87d1580218dfd8b736 to your computer and use it in GitHub Desktop.
A perl cgi script to collect and send plain feedback to a list of site admin emails. This script can be used for contact us form, just need to ensure that the form fields match the param names in the script and update the corresponding email addresses. CGI.pm module is required on the server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use CGI; | |
# Create a CGI.pm object | |
my $cgi = new CGI; | |
# Get the form data | |
my $email_address = $cgi->param('email'); | |
my $feedback = $cgi->param('message'); | |
my $name = $cgi->param('name'); | |
my $contact = $cgi->param('contact'); | |
my $company= $cgi->param('company'); | |
my $subject = $cgi->param('subject'); | |
# Email the form data | |
open ( MAIL, "| /usr/lib/sendmail -t" ); | |
print MAIL "From: $email_address\n"; | |
print MAIL "To: tonyvu2008\@gmail.com\n"; | |
print MAIL "CC: dinhthe.vu\@tangs.net\n"; | |
print MAIL "BCC: someone\@yahoo.com\n"; | |
print MAIL "Subject: $subject\n\n"; | |
print MAIL "Name: $name\nContact: $contact\nCompany: $company\n\n"; | |
print MAIL "$feedback\n"; | |
print MAIL "\n.\n"; | |
close ( MAIL ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment