in reply to Re: Problems using Mail::Sender
in thread Problems using Mail::Sender

:-)
You can also instruct the newest versions of Mail::Sender to throw an exception (die()) in case of errors. I guess that's a bit safer and easier since then you do not have to worry about each and every method call and just catch the exception where it makes most sense:

eval { my $sender = new Mail::Sender { 'on_errors' => 'die', 'smtp' => $mail_server, 'from' => $id, 'auth' => 'CRAM-MD5', 'authid' => $id, 'authpwd' => $pswd, 'subject' => 'Birthday invitation', 'boundary' => 'A boring Multipart boundary', 'multipart' => 'mixed', 'encoding' => 'Quoted-printable', 'confirm' => 'reading', 'keepconnection' => 'true'}); $sender->OpenMultipart(...); $sender->Part(...); ... }; if ($@) { print "Failed to sent the message: $@\n"; } ...

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature