Can you clarify what you mean by Net::SMTP not returning useful error codes to the caller?

I use Net::SMTP in various applications, and haven't noticed this deficiency. Since Net::SMTP is a subclass of Net::Cmd you can get the 3-digit return code very easily, as the following snippet shows:

$smtp = Net::SMTP->new($host); print ">>Connected to $host\n"; print $smtp->banner()."\n[".$smtp->code()."] ".$smtp->message()."\n"; $smtp->mail($fromaddr); print ">>MAIL FROM: $fromaddr<<\n[".$smtp->code()."] ".$smtp->message( +)."\n"; $smtp->to($toaddr); print ">>RCPT TO: $toaddr<<\n[".$smtp->code()."] ".$smtp->message()."\ +n"; $smtp->data(); print ">>DATA\n[".$smtp->code()."] ".$smtp->message()."\n"; $smtp->datasend("From: \"$fromname\" <$fromaddr>\n"); $smtp->datasend("To: $toaddr\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); $smtp->datasend("$data\n"); $smtp->dataend(); print ">>End of DATA\n[".$smtp->code()."] ".$smtp->message()."\n"; $smtp->quit; print ">>Closed connection\n[".$smtp->code()."] ".$smtp->message()."\n +";

Maybe I misunderstood you - if so, apologies.

But returning to the original problem, if it was once working and now is not, there could be something up with your mail server. Maybe someone has changed the config, so that it expects you to authenticate yourself first, or something. At the very least, you should amend your existing code to print out the responses from the server, and see what that tells you.

s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&;

In reply to Re^2: Sending e-mail problem by muntfish
in thread Sending e-mail problem by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.