Try checking the return values of the calls to mail() and to() -- it is most likely rejecting the data being sent at one of those points (at least for the last set of errors). Because of that, your request to send data is similarly denied, so when you are sending the headers, it is still trying to read them as SMTP commands, which they of course are not.

This is probably not a Perl issue at all -- just an issue of what the SMTP server will accept. You can telnet to port 25 of the mail server manually and see for yourself, sending from your end:

HELO your.server.name MAIL FROM: your@email.addr RCPT TO: their@email.addr DATA Subject: your e-mail here testing .
After the helo,mail and rcpt commands, you should get a return code of 250 (ok), or one that starts with 4 (temporary denial), or 5 (permanent denial) and some text description of the action.

The helo is usually a gimme, but that first error message you get in the browser might suggest it's comparing the answer you give here to the reverse lookup of the IP you are connecting from and denying because they don't match.

After the DATA command, you should get a 354 return code if it's going to accept your mail.

After terminating the mail with a line that's just a dot and return, you'll again get a 250 for ok or a temporary or permanent failure message.

This is a bit of a simplification of things -- for more than you really want to know, see RFC 821.


In reply to Re: SMTP problem by mattriff
in thread SMTP problem by pskiz

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.