Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Mail::Sender giving me an error

by donkeykong (Novice)
on Aug 06, 2009 at 21:24 UTC ( [id://786596] : note . print w/replies, xml ) Need Help??


in reply to Re: Mail::Sender giving me an error
in thread Mail::Sender giving me an error

Thanks a lot! Why is it that I can't call 'use Mail::Sender' outside of the sub?

Replies are listed 'Best First'.
Re^3: Mail::Sender giving me an error
by Anonymous Monk on Aug 06, 2009 at 21:32 UTC
    Why is it that I can't call 'use Mail::Sender' outside of the sub?

    Who said you can't? I just like things neat

    send_mail('subject', 'body'); sub send_mail { use Mail::Sender; my( $subject, $body ) = @_; my $sender = Mail::Sender->new({ on_errors => 'die', smtp => 'xxxx', from => 'dk@dk.com', fake_from => 'Ping Service' }); $sender->MailFile( { to => 'diki@dk.com', subject => $subject, msg => $body }); $sender->Close; }