[Techtalk] perl mail script troubles :o(

Kai MacTane kmactane at GothPunk.com
Wed Jan 2 20:45:55 EST 2002

At 1/2/02 07:28 PM , Nicole Zimmerman wrote:

>I tried relaying through a linux box and it refused relay but the script
>did nothing to note it (it looked like it processed correctly). Which
>could mean that ANY server I connect to is refusing to relay my messages
>and I will never know about it through the script. Regardless, I can
>format addresses such that the mail server *should* relay (or use a mail
>server that I lie on the network for).

Hmmm. I'm not too familiar with Net::SMTP, so I'm going out on a bit of a 
limb here...

Do you have a way of checking what the SMTP return code is when you send 
your message? I.e., can you find out if you're returned a "250 OK" or a 
"550 Relaying Denied" or whatnot?

I see in your sample code that you're essentially sending the message with 
$msg->close; it looks like it doesn't return anything. Or does close() 
maybe return the SMTP code, so you could do something like:

my $diagnostic = $msg->close;
print "SMTP server returned $diagnostic.\n";

Another way of checking this might be to set the SMTP server you're using 
to allow relaying from your test machine's IP address, if it has a static one.

(I'm assuming here that the SMTP server is on a different machine than the 
one running the script. Is that right?)

Of course, it's possible that your MIME is somehow malformed, and the SMTP 
server may be barfing on that. Have you tried just sending a nice, 
text/plain mail to test?

                                                 --Kai MacTane
"This trembling, adored,
  Tousled bird mad girl..."
                                                 --The Cure,

More information about the Techtalk mailing list