shehryarshafiq
Programmer
hi,
i have the following perl script which is used to send an email to a certain user who has filled out a form. i'm basically emailing them their username and password.
what i want the perl script to do is grab the email address the user has provided and insert it instead of where it has my email address (shehryarshafiq@hotmail.com) ie i want the mail sent to the address the user has specified.
the fields in the form are called emailaddress and password
any help would be much appreciated.
here it is:
#!/usr/bin/perl
use CGI;
my $q = new CGI;
#print $q->redirect('print $q->redirect('
my $FROM = 'blah@blah.com;
my $TO = 'shehryarshafiq@hotmail.com';
my $SUBJECT = 'BLAH BLAH BLAH';
my $BODY = "blahblahblah\n\n";
my @fields = qw( emailaddress password );
foreach (@fields) {
if($q->param($_)) {
$BODY .= "$_: " . $q->param($_) . "\n"
}
}
open( EZMAIL, "|/bin/easymail -t" ) or die (q(Can't open easymail));
print EZMAIL "From: $FROM\nTo: $TO\n";
print EZMAIL "Subject: $SUBJECT\n";
print EZMAIL "\n$BODY\n";
# print EZMAIL "\n.\n";
# this appends a dot to the mail body
# it appears to be an artefact of a
# previous version of the script, which
# interacted directly via SMTP, and had to send a
# dor to indicate the end of the DATA section...
close( EZMAIL );
i have the following perl script which is used to send an email to a certain user who has filled out a form. i'm basically emailing them their username and password.
what i want the perl script to do is grab the email address the user has provided and insert it instead of where it has my email address (shehryarshafiq@hotmail.com) ie i want the mail sent to the address the user has specified.
the fields in the form are called emailaddress and password
any help would be much appreciated.
here it is:
#!/usr/bin/perl
use CGI;
my $q = new CGI;
#print $q->redirect('print $q->redirect('
my $FROM = 'blah@blah.com;
my $TO = 'shehryarshafiq@hotmail.com';
my $SUBJECT = 'BLAH BLAH BLAH';
my $BODY = "blahblahblah\n\n";
my @fields = qw( emailaddress password );
foreach (@fields) {
if($q->param($_)) {
$BODY .= "$_: " . $q->param($_) . "\n"
}
}
open( EZMAIL, "|/bin/easymail -t" ) or die (q(Can't open easymail));
print EZMAIL "From: $FROM\nTo: $TO\n";
print EZMAIL "Subject: $SUBJECT\n";
print EZMAIL "\n$BODY\n";
# print EZMAIL "\n.\n";
# this appends a dot to the mail body
# it appears to be an artefact of a
# previous version of the script, which
# interacted directly via SMTP, and had to send a
# dor to indicate the end of the DATA section...
close( EZMAIL );