The script will enact when the following (an example) is pasted into the address bar:
http://mywebsite.com/cgi-bin/emailscript.cgi?email@isp.com
Quite simply, the given script takes a look at the email address that is listed following the question mark, and sends the desired response directly there.
Although there are several ways of instructing Perl to send email and where to send it to. Our example uses the simplest and most straightforward one.
Here, before we analyze it, here is the full script of our example email:
#!/usr/bin/perl
$Mailer = '/sbin/sendmail -t';
$Email = $ENV{QUERY_STRING};
open MAIL,"|$Mailer";
print MAIL <<THE_EMAIL;
From: me\@mywebsite.com
To: $Email
Subject: Auto response email
Thank you for your message, we will be in touch soon
regards
THE_EMAIL
close MAIL;
print "Content-type: text/html\n\n";
print '<center>T H A N K Y O U !</center>';
# end of script
Now, lets look at the individual elements to understand the function they provide.