Hi,

I cannot work out why the following script does not work

#!/usr/bin/perl -wT use Net::SMTP; $smtp = Net::SMTP->new('mailservername.net', Debug => 1, ); $smtp->mail('peter@mydomain.com'); $smtp->to("peter\@home.emailaddress.com"); $smtp->data(); $smtp->datasend("To: Peter\n"); $smtp->datasend("\n"); $smtp->datasend("test send\n"); $smtp->dataend(); $smtp->quit;

There are no error messages, and no email received, yet when I use the (NMS) FormMail.pl on the same domain (my feedback form), I get an email back in one minute (I'm using Perl 5.006001). The script is starting to 'talk' to the mail server, because when I try to get the server 'banner', it gives me:

"mailservername.net ESMTP Exim 4.20 #1 Sat, 04 Oct 2003 01:28:37 -0400 "

Are there any methods to debug this script ? To somehow see what the email server is doing, any way to get 'echos' displayed, or any modules to add to give me debug information (The "error_log" file is empty, btw) Are there any issues with the code that could make it not work ?

Peter


In reply to Net::SMTP and debugging ? by peterr

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.