Net::SMTP errors

D

david.karr

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
elided):

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

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

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

$smtp->quit;
}

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 att.com
Net::SMTP=GLOB(0x10b822c0)<<< 250-<our smtp host> Hello <myhost>
[<myip>], pleased to meet you
Net::SMTP=GLOB(0x10b822c0)<<< 250-ENHANCEDSTATUSCODES
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)>>> RCPT TO:<<myid>@<mydomain>>
NOTIFY=SUCCESS,FAILURE,DELAY
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
connection
 
P

Peter J. Holzer

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
elided):

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

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

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

$smtp->quit;
}

The output I see is the following (some fields elided): [...]
Net::SMTP=GLOB(0x10b822c0)>>> MAIL FROM:<<myid>>
Net::SMTP=GLOB(0x10b822c0)<<< 553 5.5.4 <<myid>>... Domain name
required for sender address <myid>

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

hp
 
R

RedGrittyBrick

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
elided):

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

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

$smtp->mail($ENV{USER});

According to http://search.cpan.org/~gbarr/libnet-1.22/Net/SMTP.pm the
parameters for the mail() method are mail ( ADDRESS [, OPTIONS] ) where
ADDRESS is the address of the sender.

$ENV{USER} is unlikely to be an email address.


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

$smtp->quit;
}

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 att.com
Net::SMTP=GLOB(0x10b822c0)<<< 250-<our smtp host> Hello<myhost>
[<myip>], pleased to meet you
Net::SMTP=GLOB(0x10b822c0)<<< 250-ENHANCEDSTATUSCODES
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>

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

Net::SMTP=GLOB(0x10b822c0)>>> RCPT TO:<<myid>@<mydomain>>
NOTIFY=SUCCESS,FAILURE,DELAY
Net::SMTP=GLOB(0x10b822c0)<<< 503 5.0.0 Need MAIL before RCPT

You haven't sent a valid MAIL command.
 
P

Peter J. Holzer

In <[email protected]>, on
04/12/2010


From RFC 5321:

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


See above.
Yup.



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

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

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

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.

hp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top