
xter74
Novice
Oct 18, 2002, 12:53 AM
Post #5 of 7
(1398 views)
|
here's my rountine....really appreciate all the help given.... ********************************************************** $filename = 'E:/Webs/blt.sgp.hp.com/share/cgi-bin/mail.log'; open(THATFILE, "filename") || die "cannot open $filename: $!"; while (<THATFILE>) { $_ = $DATA; } open LOG, '>> E:/Webs/blt.sgp.hp.com/share/cgi-bin/smtp.log' or die "Cannot open file"; print LOG "\n===============================================\n"; print LOG scalar(localtime), " Started log.\n"; use IO::Socket; $SMTP_SERVER="ctss21.sgp.hp.com"; $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "$SMTP_SERVER", PeerPort => "smtp(25)", ) || die "cannot connect to SMTP port on $SMTP_SERVER\n"; $remote->autoflush(1); $inline = <$remote>; if( $inline !~ /^220/ ) { print LOG "Didn't get 220 response: $inline"; return; } print LOG $inline; print $remote "HELO $SMTP_SERVER\n"; $inline = <$remote>; if( $inline !~ /^250/ ) { print LOG "Didn't get 250 response at HELO: $inline"; return; } print LOG "$inline"; print $remote "MAIL From: ap-blt_support\@hp.com\n"; $inline = <$remote>; if( $inline !~ /^250/ ) { print LOG "Didn't get 250 response at MAIL: $inline"; return; } print LOG "$inline"; print "<br>sending: ", "RCPT To: $dst_addr\n <BR>"; print $remote "RCPT To: arsystem\@uspsgn01.sgp.hp.com \n"; $inline = <$remote>; if( $inline !~ /^250/ ) { print LOG "Didn't get 250 response at RCPT: $inline"; return; } print LOG "$inline"; print $remote "DATA\n"; $inline = <$remote>; if( $inline !~ /^354/ ) { print LOG "Didn't get 354 response at DATA: $inline"; return; } print LOG "$inline"; print "\n============>$inline"; print $remote $DATA; ### <<---- THIS IS THE LINE THAT WRITE IN THE MSG BODY print $remote "\n.\n"; $inline = <$remote>; print LOG $inline; print $remote "QUIT\n"; $inline = <$remote>; print LOG $inline; } close(THATFILE) || die "can't close $file: $!"; }
|