-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcgimail.pl
executable file
·46 lines (44 loc) · 1.58 KB
/
cgimail.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl -w
use strict;
use CGI;
use Email::Valid;
my $query = new CGI;
# it is important to check the validity of the email address
# # supplied by the user both to catch genuine (mis-)typing errors
# # but also to avoid exploitation by malicious users who could
# # pass arbitrary strings to sendmail through the "send_to"
# # CGI parameter - including whole email messages
# unless (Email::Valid->address($query->param('send_to'))) {
# print $query->header;
# print "You supplied an invalid email address.";
# exit;
# }
#
# my $sendmail = "/usr/sbin/sendmail -t";
# my $reply_to = "Reply-to: foo\@bar.org\n";
# my $subject = "Subject: Confirmation of your submission\n";
# my $content = "Thanks for your submission.";
# my $to = $query->param('send_to')."\n";
# my $file = "subscribers.txt";
#
# unless ($to) {
# print $query->header;
# print "Please fill in your email and try again";
# }
#
# open (FILE, ">>$file") or die "Cannot open $file: $!";
# print $to,"\n";
# close(FILE);
#
# my $send_to = "To: ".$query->param('send_to');
#
# open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
# print SENDMAIL $reply_to;
# print SENDMAIL $subject;
# print SENDMAIL $send_to;
# print SENDMAIL "Content-type: text/plain\n\n";
# print SENDMAIL $content;
# close(SENDMAIL);
#
# print $query->header;
# print "Confirmation of your submission will be emailed to you.";