im writing a script that sends email to a few big wigs detailing the information a user has input into an order form. The code is below:

#!/usr/local/bin/perl -wT use Net::SMTP; print "Content-type: text/plain", "\n\n"; my $DEBUG = 1; if ($DEBUG) { $| = 1; open(STDERR, ">&STDOUT"); } # smtp server name my $serverName = "mail.blah.com"; # create a new smtp object $smtp = Net::SMTP->new($serverName, Debug => 1); # if you can't connect then dont proceed with the rest of the script die "Couldn't connect to server" unless $smtp; # initiate the mail transaction # your "real" email address my $from = "crap\@blah.com"; # recipient's "real" email address my $to = "poop\@toilet.com"; $smtp->mail($from); $smtp->to($to); # start the mail $smtp->data(); # send the header # this address will appear in the message $smtp->datasend("To: poop\@toilet.com\n"); # so will this one $smtp->datasend("From: crap\@blah.com\n"); $smtp->datasend("Subject: Online Ordering Test Message\n"); $smtp->datasend("\n"); # send the body $smtp->datasend("TESTING TESTING TESTING\n\n"); # send the termination string $smtp->dataend(); # close the connection $smtp->quit();

i get this in the browser window:

Relaying denied. IP name possibly forged

i really dont know whats going on. if i send an email using this script to myself i dont get that error, but i also dont get the mail.

i also get these errors:

Net::SMTP=GLOB(0x8114994)<<< 500 5.5.1 Command unrecognized: "To: poop +@toilet.com" Net::SMTP=GLOB(0x8114994)>>> QUIT Net::SMTP=GLOB(0x8114994)<<< 500 5.5.1 Command unrecognized: "From: cr +ap@blah.com"

any help is greatly appreciated

Janitored by Arunbear - added readmore tags, as per Monastery guidelines


In reply to 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.