G
gsanuser
Hello,
We are using MIME::Lite (ver 2.117) and Net::SMTP (ver 2.19) for sending mail
from a Solaris box (perl 5.6.1).
We have a method which simplified looks like:
sub sendMail (
my $msg = build MIME::Lite(...) ;
attach $msg (...attachement ....) ;
$msg->send_by_smtp() || return 0;
return 1;
)
we are finally checking if sendMail() returns 0 or 1 in order to flag mails
correctly sent or not.
It appears that this way we are able to trap errors like "cannot connect to
host", or some STMP errors (like 500 Syntax error) but not all, i.e. error 452
(insufficient system storage) is not detected (that is, our sendMail() returns 1
as it were no problems).
Particularly errors from dataend() are not trapped. Following code from
MIME::Lite ver 2.117):
my $smtp = MIME::Lite::SMTP->new(@args) or Carp::croak("Failed to connect to
mail server: $!\n");
$smtp->mail($from) or Carp::croak("SMTP MAIL command failed:
$!\n".$smtp->message."\n");
$smtp->to(@to_all) or Carp::croak("SMTP RCPT command failed:
$!\n".$smtp->message."\n");
$smtp->data() or Carp::croak("SMTP DATA command failed:
$!\n".$smtp->message."\n");
$self->print_for_smtp($smtp);
$smtp->dataend() ;
Just asking group if this is a bug or a feature, and what is the best way to
correct this issue.
Just adding something like:
$smtp->dataend() or Carp::croak("SMTP DATAEND command failed:
$!\n".$smtp->message."\n");
or
unless (($smtp->code())== 250){Carp::croak("Mail is Not Correltly Delivered via
SMTP");}
Thanks much,
Gabriel
We are using MIME::Lite (ver 2.117) and Net::SMTP (ver 2.19) for sending mail
from a Solaris box (perl 5.6.1).
We have a method which simplified looks like:
sub sendMail (
my $msg = build MIME::Lite(...) ;
attach $msg (...attachement ....) ;
$msg->send_by_smtp() || return 0;
return 1;
)
we are finally checking if sendMail() returns 0 or 1 in order to flag mails
correctly sent or not.
It appears that this way we are able to trap errors like "cannot connect to
host", or some STMP errors (like 500 Syntax error) but not all, i.e. error 452
(insufficient system storage) is not detected (that is, our sendMail() returns 1
as it were no problems).
Particularly errors from dataend() are not trapped. Following code from
MIME::Lite ver 2.117):
my $smtp = MIME::Lite::SMTP->new(@args) or Carp::croak("Failed to connect to
mail server: $!\n");
$smtp->mail($from) or Carp::croak("SMTP MAIL command failed:
$!\n".$smtp->message."\n");
$smtp->to(@to_all) or Carp::croak("SMTP RCPT command failed:
$!\n".$smtp->message."\n");
$smtp->data() or Carp::croak("SMTP DATA command failed:
$!\n".$smtp->message."\n");
$self->print_for_smtp($smtp);
$smtp->dataend() ;
Just asking group if this is a bug or a feature, and what is the best way to
correct this issue.
Just adding something like:
$smtp->dataend() or Carp::croak("SMTP DATAEND command failed:
$!\n".$smtp->message."\n");
or
unless (($smtp->code())== 250){Carp::croak("Mail is Not Correltly Delivered via
SMTP");}
Thanks much,
Gabriel