0 Пользователей и 1 Гость просматривают эту тему.
sub send_mail {shift @_;my $result = 0;my $smtpserver = shift @_;my $smtpport = shift @_;my $from = shift @_;my $to = shift @_;my $subj = shift @_;my $message = shift @_;my $attache = shift @_;my $logfile = shift @_; #;read_conf($conf,\'logfile\') || \'/var/log/urbd.log\' ;print "Sending mail:\\n";print "SMTP - $smtpserver\\n";print "SMTP PORT - $smtpport\\n";print "FROM: $from\\n";print "TO: $to\\n";print "Subject: $subj\\n";print "Attached file: $attache\\n\\n";print "\\n========------------- SMTP HEADER ---------------========\\n";&logfile(\'sk_mod\',$logfile,"Sending mail...$subj");$message = "$message \\n\\n";open (MES, $logfile);while () { $message = "$message$_";}close(MES);my $sender = new Mail::Sender {smtp => $smtpserver, from => $from};$sender->MailFile({to => $to, subject => $subj, msg => $message, file => $attache}) or $result = 1; $sender->Close;# || &logfile($logfile,"Failed sand message $sender->{\'error_msg\'}"); # or $result = 2;print "\\nresult of sending mail ... :$result\\n";if ($result == 0) { &logfile(\'sk_mod\',$logfile,"Mail sended");}if ($result == 2) { &logfile(\'sk_mod\',$logfile,"Failed sand message $sender->{\'error_msg\'}");}sleep 5;return $result;}
123[root@k] /usr/ports/mail/p5-Mail-Sender/:/usr/local/script/urbd/bin/urbdmailclean.pl -conf=/usr/local/script/urbd/etc/sk_mailclean.confOk!Trying send mail....Sending mail:SMTP - 127.0.0.lSMTP PORT - 25FROM: mailclean.urbdTO: mailclean.report@klo.kiev.uaSubject: CLEAN MAIL REPORTAttached file: /usr/local/script/urbd/log/mailclean.log========------------- SMTP HEADER ---------------========Can\'t call method "MailFile" without a package or object reference at /usr/local/script/urbd/lib/sk_mod.pm line 86.[root@k] /usr/ports/mail/p5-Mail-Sender/: