|
-
Mar 13th, 2002, 11:47 AM
#1
Thread Starter
Lively Member
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 = "[email protected]";
my $from = "[email protected]";
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|