From: Jose V. N. Z. <jo...@ne...> - 2002-09-18 22:15:37
|
Is really bizarre... i tested the code on another machine and it works. B= ut if i use your code in the same machine then no email is sent. At least i known that the "server" property works :) I went and run a small program i have that uses Net::SMTP directly and th= is is what i got (the email is sent): Net::SMTP: Net::SMTP(2.15) Net::SMTP: Net::Cmd(2.18) Net::SMTP: Exporter(5.562) Net::SMTP: IO::Socket::INET(1.25) Net::SMTP: IO::Socket(1.26) Net::SMTP: IO::Handle(1.21) Net::SMTP=3DGLOB(0x103244)<<< 220 ZZZZ ESMTP Sendmail WWW/WWW; Wed, 18 Se= p 2002 18:08:38 -0400 Net::SMTP=3DGLOB(0x103244)>>> EHLO YYYY Net::SMTP=3DGLOB(0x103244)<<< 250-ZZZZZ Hello sol0001.ZZZZZ [XX.XX.XX.XX= ], pleased to meet you Net::SMTP=3DGLOB(0x103244)<<< 250-ENHANCEDSTATUSCODES Net::SMTP=3DGLOB(0x103244)<<< 250-8BITMIME Net::SMTP=3DGLOB(0x103244)<<< 250-SIZE Net::SMTP=3DGLOB(0x103244)<<< 250-DSN Net::SMTP=3DGLOB(0x103244)<<< 250-ONEX Net::SMTP=3DGLOB(0x103244)<<< 250-ETRN Net::SMTP=3DGLOB(0x103244)<<< 250-XUSR Net::SMTP=3DGLOB(0x103244)<<< 250 HELP Net::SMTP=3DGLOB(0x103244)>>> MAIL FROM:<KKKKK> Net::SMTP=3DGLOB(0x103244)<<< 250 2.1.0 <KKKKK>... Sender ok Net::SMTP=3DGLOB(0x103244)>>> RCPT TO:<KKKKK> Net::SMTP=3DGLOB(0x103244)<<< 250 2.1.5 <KKKK>... Recipient ok Net::SMTP=3DGLOB(0x103244)>>> DATA Net::SMTP=3DGLOB(0x103244)<<< 354 Enter mail, end with "." on a line by i= tself Net::SMTP=3DGLOB(0x103244)>>> To: KKKK Net::SMTP=3DGLOB(0x103244)>>> Subject: Testing mail program Net::SMTP=3DGLOB(0x103244)>>>=20 Net::SMTP=3DGLOB(0x103244)>>> This is a test message Net::SMTP=3DGLOB(0x103244)>>> . Net::SMTP=3DGLOB(0x103244)<<< 250 2.0.0 g8IM8cu32649 Message accepted for= delivery Net::SMTP=3DGLOB(0x103244)>>> QUIT Net::SMTP=3DGLOB(0x103244)<<< 221 2.0.0 ZZZZZ closing connection I'm clueless here. There is a way i can activate the Debug option from th= e logger so i can see whats going on? Thanks in advance. JV. On Wed, 18 Sep 2002 14:53:24 -0700 Kevin Goess <ke...@go...> wrote: > Jose, this works for me, I get an email just fine, note that mail.serve= r=20 > should be your outgoing smtp server, right? >=20 > --------------------------------------------- > use Log::Log4perl; >=20 > Log::Log4perl->init(\' > log4perl.logger.Veronicad=3DDEBUG, screen, mail > log4perl.appender.screen=3DLog::Dispatch::Screen > log4perl.appender.screen.stderr=3D0 > log4perl.appender.screen.layout=3DLog::Log4perl::Layout::PatternLayout > log4perl.appender.screen.layout.ConversionPattern=3D%d %p> %F{1}:%L %M = - %m%n > log4perl.appender.mail=3DLog::Dispatch::Email::MailSend > log4perl.appender.mail.name=3DVeronicad > log4perl.appender.mail.subject=3DVeronicad event > log4perl.appender.mail.to=3D...@yo... *** > log4perl.appender.mail.from=3D...@yo... *** > log4perl.appender.mail.buffered=3D0 > log4perl.appender.mail.server=3Dmail.yourdomain.com *** > log4perl.appender.mail.layout=3DLog::Log4perl::Layout::PatternLayout > log4perl.appender.mail.layout.ConversionPattern=3D%d %p> %F{1}:%L %M - = %m%n > '); > my $logger =3D Log::Log4perl::get_logger("Veronicad"); >=20 > $logger->error("Testing errors"); > --------------------------------------------------------------- >=20 > Jose Vicente Nunez Zuleta wrote: > > First of all thanks for this cool port of the Log4j API; This tool is= going to make our lives easier :) > >=20 > > So far i managed to add the logging functionality to my application (= part of my perl code): > >=20 > > use constant OK_CODE =3D> 0; > > use constant ERROR_CODE =3D> 1; > > use constant LOG_CONFIG =3D> "/usr/local/sysadmin/VeronicadLog4perl.p= roperties"; > > use constant REFRESH_LOG_CONFIG =3D> 300; > >=20 > > # ----- END User configurable parameters -------- > >=20 > > # Start the logger > > Log::Log4perl->init_and_watch(LOG_CONFIG, REFRESH_LOG_CONFIG); > > my $logger =3D get_logger("Veronicad"); > >=20 > > $logger->error("Testing errors"); > >=20 > > And here is my configuration file info with three appenders: > >=20 > > log4perl.logger.Veronicad=3DDEBUG, syslog, screen, mail > > log4perl.appender.screen=3DLog::Dispatch::Screen > > log4perl.appender.screen.stderr=3D0 > > log4perl.appender.screen.layout=3DLog::Log4perl::Layout::PatternLayou= t > > log4perl.appender.screen.layout.ConversionPattern=3D%d %p> %F{1}:%L %= M - %m%n > > log4perl.appender.syslog=3DLog::Dispatch::Syslog > > log4perl.appender.syslog.name=3DVeronicad > > log4perl.appender.syslog.facility=3Ddaemon > > log4perl.appender.syslog.socket=3Dinet > > log4perl.appender.syslog.layout=3DLog::Log4perl::Layout::PatternLayou= t > > log4perl.appender.syslog.layout.ConversionPattern=3D%d %p> %F{1}:%L %= M - %m%n > > log4perl.appender.mail=3DLog::Dispatch::Email::MailSend > > log4perl.appender.mail.name=3DVeronicad > > log4perl.appender.mail.subject=3DVeronicad event > > log4perl.appender.mail.to=3D...@em...dress > > log4perl.appender.mail.from=3D...@em...dress > > log4perl.appender.mail.buffered=3D0 > > log4perl.appender.mail.server=3Dmy.mail.server <--- NOT SURE ABOUT T= HIS!!!!!! > > log4perl.appender.mail.layout=3DLog::Log4perl::Layout::PatternLayout > > log4perl.appender.mail.layout.ConversionPattern=3D%d %p> %F{1}:%L %M = - %m%n > >=20 > > But the application doesn't sends an email when i got an error (just = runs without sending the email): > >=20 > > bash-2.04# ./Veronicad.pl=20 > > 2002/09/18 14:36:16 ERROR> Veronicad.pl:34 main:: - Testing errors > > 2002/09/18 14:36:16 INFO> Veronicad.pl:45 main:: - [Server ./Veronica= d.pl accepting clients] > >=20 > >=20 > > So far reading the man page i found that "Log::Dispatch::Email::MailS= end" is a subclass of 'Mail::Send' wich also inherits > > from 'Mail::Mailer'. 'Mail::Mailer' can specify to use an external SM= TP server like this: > >=20 > > ""smtp"" > > Use the "smtp" protocol via Net::SMTP to deliver the > > mail. The server to use can be specified in "@args" > > with > >=20 > > $mailer =3D new Mail::Mailer 'smtp', Server =3D> $serv= er; > >=20 > > The smtp mailer does not handle "Cc" and "Bcc" lines, > > neither their "Resent-*" fellows. The "Debug" options > > enables debugging output from "Net::SMTP". > >=20 > >=20 > > How i can achieve the same using 'Log::Dispatch::Email::MailSend' cla= ss? > >=20 > > There is a environment variable i can set so i can force the ussage o= f this SMTP server? > >=20 > > There is a way to debug if this is working? > >=20 > > I can send email using the external mail server using Net::SMTP and t= hat class is already installed on my system. > >=20 > > Thanks in advance, > >=20 > > Jose Vicente. > >=20 > >=20 > >=20 >=20 >=20 > --=20 > Happy Trails . . . >=20 > Kevin M. Goess > (and Anne and Frank) > 904 Carmel Ave. > Albany, CA 94706 > (510) 525-5217 >=20 --=20 Jos=E9 Vicente N=FA=F1ez Zuleta Newbreak LLC System Administrator (http://www.newbreak.com) Phone: 203-355-1511, 203-355-1510 Fax: 203-355-1512 |