ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-mod_perl
perl-mod_perl
Re: Mod_Perl and Net::SMTP
by Philip M. Gollucci other posts by this author
Oct 3 2008 7:34AM messages near this date
Mod_Perl and Net::SMTP | Re: Mod_Perl and Net::SMTP
Guy Alston wrote:
  Error message:
>  Can't call method "mail" on an undefined value at 
>  sys:/perl/web/mailtest2.pl line 6.
>   
>  It's always a line containing " $smtp = Net::SMTP->new("smtpserver")

Net::SMTP is known to work, though I'm not currently using it.
You could add

local $SIG{__WARN__} = \&Carp::cluck;
local $SIG{__DIE__}  = \&Carp::confess;

This will help tell you where in Net::SMTP you are having a problem.

Once you know that, you can try to fix it.

OR this works --

use MIME::Lite ();

sub email {
     my %args = @_;

     my $email = MIME::Lite-> new( Type => 'multipart/mixed' );

     $email-> add(To      => $args{to});
     $email-> add(BCC     => $args{bcc});
     $email-> add(From    => $args{from});
     $email-> add(Subject => $args{subject});

     $email-> attach(Type => "TEXT", Data => $args{data});

     MIME::Lite-> send('smtp', SMTP_HOST, Timeout => 5);

     eval { $email-> send };

     return $@;
}


>   
>  I tried many different scripts but it always seems to be a problem 
>  around the object  utilizing "Net::SMTP;.  Is there a known issue with 
>  this. My version of MOD_PERL is 1.01.00

Was I even alive when this version of mod_perl was out ?

Given that, more importantly, what version of perl are you using ?
Thread:
Guy Alston
Philip M. Gollucci
Guy Alston
Guy Alston
Guy Alston

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved