|
CGI (Perl) - SMTP & Rediret Method -
Good day !
I have written the codes below and try to execute it. Theoritically, I suppose it works but it doesn't. I can't figure out what's wrong with my codes. The 2 problems are : 1) It supposed to send back a mail to me but it doesn't. I used the code from Deitel & Deitel text book. 2) It doesn't redirect to the page "default.asp" after executing the commands. May be I had put the code at the wrong place ? Anybody can look at my code and tell me what's wrong ? Thanks a lot ! -------------------------------------------------------------------------------- use Net::SMTP; use CGI qw/:standard/; my $to = "chboo81@hotmail.com"; my $from = "chboo81@hotmail.com"; my $subject = param ("SelectPurpose"); my $message = param ("TxtMessage"); my $mailserver = "hotmail.com"; print header; print "<p>Your message has been sent !"; print "Thank you for your contribution !"; $smtp = Net::SMTP->new($mailserver); $smtp->mail($ENV{USER}); $smtp->to("$to"); $smtp->data(); $smtp->datasend("To : $to \n"); $smtp->datasend("From : $from \n"); $smtp->datasend("Subject: $subject \n"); $smtp->datasend("\n"); $smtp->datasend("$message \n"); $smtp->datasend(); $smtp->quit; print redirect('../default.asp'); ----------------------------------------------------------------------------- Thanks again ! SonicWave
CGI (Perl) - SMTP & Rediret Method - |