I would approciate help on this program as it generates the following error (the email addresses are not real in this example):

RCPT TO:<validrecipient@validdomain.com>
501 Unknown Command

also

544 no valid RCPT address specified (the address is a valid one, I can send mail using hotmail, MS Outlook Express and Ximian, is it probably because of the 501 error above?)

additionally:
the $smtp->dataend(); generates a 501 unknown command, as does the $smtp->quit;

What am I doing wrong? Or has my ISP implemented ESMTP in a weird way so that Net::SMTP commands are not understood by their server?

Thanks!

Here's the program:
use Net::SMTP; sSendEmail('validrecipient@validdomain.com','validrecipient@validdomai +n.com','ssssssubject','bbbbbbody'); sub sSendEmail { my ($to,$from,$subject,@body) = @_; my $smtp = Net::SMTP->new('mail.validdomain.com', Debug => 1); die "Could not open SMTP connection $!" if (! defined $smtp); print "Connected to: ", $smtp->domain. "\n"; $smtp->auth('garykuipers@ondacom.biz','judge'); print "debug:before recipient\n"; $smtp->recipient($to); print "debug:after recipient\n"; $smtp->mail($from); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("From: $from\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); foreach my $line (@body) { $smtp->datasend("$line\n"); } print "debug:before dataend\n"; $smtp->dataend(); print "debug:before quit\n"; $smtp->quit; print "debug:after quit\n"; print "Mail sent to: |$to|\n"; }

Edit by dws to use <code> tags


In reply to Net::SMTP generates unexpected errors in Debug Mode by gary kuipers

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.