Net::SMTP errors

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm putting some code in an existing script to send an email
notification. I've read the Net::SMTP CPAN page.  I'm not doing
anything complicated. I appear to be getting SMTP errors, but I don't
understand how to fix this.

The method I wrote to send the message is the following (some data

sub sendUpdateNotification($$$) {
    my ($message, $mailhost, $maildest) = @_;
    my $smtp = Net::SMTP->new($mailhost,
                  Hello => "<mydomain>",
                          Debug => 1);

    print "domain[" . $smtp->domain . "] maildest[" . $maildest . "]
    print "message[" . $message . "]\n";

    $smtp->to($maildest, {Notify => ['SUCCESS','FAILURE','DELAY']});


The output I see is the following (some fields elided):

Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>>   Net::Cmd(2.29)
Net::SMTP>>>     Exporter(5.62)
Net::SMTP>>>   IO::Socket::INET(1.31)
Net::SMTP>>>     IO::Socket(1.30_01)
Net::SMTP>>>       IO::Handle(1.27)
Net::SMTP=GLOB(0x10b822c0)<<< 220 <our smtp host> ESMTP Sendmail
8.14.2/8.14.2; Mon, 12 Apr 2010 11:22:16 -0700
Net::SMTP=GLOB(0x10b822c0)>>> EHLO
Net::SMTP=GLOB(0x10b822c0)<<< 250-<our smtp host> Hello <myhost>
[<myip>], pleased to meet you
Net::SMTP=GLOB(0x10b822c0)<<< 250-PIPELINING
Net::SMTP=GLOB(0x10b822c0)<<< 250-8BITMIME
Net::SMTP=GLOB(0x10b822c0)<<< 250-SIZE 16000000
Net::SMTP=GLOB(0x10b822c0)<<< 250-DSN
Net::SMTP=GLOB(0x10b822c0)<<< 250-ETRN
Net::SMTP=GLOB(0x10b822c0)<<< 250-DELIVERBY
Net::SMTP=GLOB(0x10b822c0)<<< 250 HELP
Net::SMTP=GLOB(0x10b822c0)>>> MAIL FROM:<<myid>>
Net::SMTP=GLOB(0x10b822c0)<<< 553 5.5.4 <<myid>>... Domain name
required for sender address <myid>
Net::SMTP=GLOB(0x10b822c0)<<< 503 5.0.0 Need MAIL before RCPT
Net::SMTP=GLOB(0x10b822c0)>>> DATA
Net::SMTP=GLOB(0x10b822c0)<<< 503 5.0.0 Need MAIL command
Net::SMTP=GLOB(0x10b822c0)>>> QUIT
Net::SMTP=GLOB(0x10b822c0)<<< 221 2.0.0 <our smtp host> closing

Re: Net::SMTP errors

Quoted text here. Click to load it
Quoted text here. Click to load it

Isn't that clear enough? Your SMTP server only accepts sender addresses
with a domain name.


Re: Net::SMTP errors

On 12/04/2010 19:31, david.karr wrote:
Quoted text here. Click to load it

According to the
parameters for the mail() method are mail ( ADDRESS [, OPTIONS] ) where
ADDRESS is the address of the sender.

$ENV is unlikely to be an email address.

Quoted text here. Click to load it

A domain name is needed in the sender's mail address.

Quoted text here. Click to load it

You haven't sent a valid MAIL command.

Quoted text here. Click to load it


Re: Net::SMTP errors


Quoted text here. Click to load it

From RFC 5321:

   Mailbox        = Local-part "@" ( Domain / address-literal )

Quoted text here. Click to load it

See above.

That looks like a bug; it should have sent a QUIT after the 553 on the
MAIL command.

Shmuel (Seymour J.) Metz, SysProg and JOAT  <

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to

Re: Net::SMTP errors

Quoted text here. Click to load it


The server announced that it supports pipelinging, so the client is
allowed to send

    MAIL FROM:<...>
    RCPT TO:<...>
    RCPT TO:<...>
    RCPT TO:<...>

all in one fell swoop and then pick up the responses. But you are right
that it doesn't look as if it did. And if the client does wait for the
response to MAIL FROM: it might as well act on it.


Site Timeline