Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Net::SMTP fails

1 view
Skip to first unread message

hend...@gmail.com

unread,
May 7, 2008, 11:01:42 AM5/7/08
to
Gang,

I am trying to use Net::SMTP to send email from a computer and it
fails to send (debug info below). I can take this same script and put
it on another computer and it works just fine. That would tell me
some piece of software isn't installed on the non-working computer,
but I have no idea as to what it may be. I have made sure the files
are the same on both computers that are listed in the "use" statements
at the top of the Net::SMTP module. I am using Debian 3.1 on the one
that works and 4.0 on the one that doesn't work. Any help would
greatly be appreciated.

Thanks,

Dave

Net::SMTP>>> Net::SMTP(2.29)
Net::SMTP>>> Net::Cmd(2.26)
Net::SMTP>>> Exporter(5.58)
Net::SMTP>>> IO::Socket::INET(1.29)
Net::SMTP>>> IO::Socket(1.29)
Net::SMTP>>> IO::Handle(1.25)
Net::SMTP=GLOB(0x82cd2dc)<<< 220 smtp106.biz.mail.re2.yahoo.com ESMTP
Net::SMTP=GLOB(0x82cd2dc)>>> EHLO digital-pipe.com
Net::SMTP=GLOB(0x82cd2dc)<<< 250-smtp106.biz.mail.re2.yahoo.com
Net::SMTP=GLOB(0x82cd2dc)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE
Net::SMTP=GLOB(0x82cd2dc)<<< 250-PIPELINING
Net::SMTP=GLOB(0x82cd2dc)<<< 250 8BITMIME

smallpond

unread,
May 7, 2008, 3:00:20 PM5/7/08
to


220 says that yahoo will accept mail using ESMTP, so you sent EHLO.
250 says OK, here's what I accept.
There's no error shown here, the next thing that you should do is
send MAIL FROM:, which you didn't.
--S


** Posted from http://www.teranews.com **

hend...@gmail.com

unread,
May 7, 2008, 3:31:33 PM5/7/08
to
On May 7, 3:00 pm, smallpond <smallp...@juno.com> wrote:

Thanks for the reply. Why would this script work just fine on one
computer and then stop at the above point on the other?

Dave

hend...@gmail.com

unread,
May 7, 2008, 3:42:31 PM5/7/08
to

I removed the authentication checking and just had the rest of the
script processed and here is the response I received:

Net::SMTP>>> Net::SMTP(2.29)
Net::SMTP>>> Net::Cmd(2.26)
Net::SMTP>>> Exporter(5.58)
Net::SMTP>>> IO::Socket::INET(1.29)
Net::SMTP>>> IO::Socket(1.29)
Net::SMTP>>> IO::Handle(1.25)

Net::SMTP=GLOB(0x82ccfac)<<< 220 smtp107.biz.mail.re2.yahoo.com ESMTP
Net::SMTP=GLOB(0x82ccfac)>>> EHLO digital-pipe.com
Net::SMTP=GLOB(0x82ccfac)<<< 250-smtp107.biz.mail.re2.yahoo.com
Net::SMTP=GLOB(0x82ccfac)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE
Net::SMTP=GLOB(0x82ccfac)<<< 250-PIPELINING
Net::SMTP=GLOB(0x82ccfac)<<< 250 8BITMIME
Net::SMTP=GLOB(0x82ccfac)>>> MAIL FROM:<nor...@netbud.local>
Net::SMTP=GLOB(0x82ccfac)<<< 530 authentication required - for help go
to http://help.yahoo.com/help/us/bizmail/pop/pop-11.html
Net::SMTP=GLOB(0x82ccfac)>>> RCPT TO:<d...@digital-pipe.com>
Net::SMTP: Unexpected EOF on command channel at /usr/lib/perl/5.8/
libemail.pm line 66


The only reason there is an error in the script at line 66 is because
all the lines were processed even though the auth failed (which the
script normally wouldn't come to if the auth section that I commented
out, failed).

Dave

A. Sinan Unur

unread,
May 7, 2008, 3:54:47 PM5/7/08
to

>> > Net::SMTP>>> Net::SMTP(2.29)
>> > Net::SMTP>>> Net::Cmd(2.26)
>> > Net::SMTP>>> Exporter(5.58)
>> > Net::SMTP>>> IO::Socket::INET(1.29)
>> > Net::SMTP>>> IO::Socket(1.29)
>> > Net::SMTP>>> IO::Handle(1.25)
>> > Net::SMTP=GLOB(0x82cd2dc)<<< 220 smtp106.biz.mail.re2.yahoo.com ESMTP
>> > Net::SMTP=GLOB(0x82cd2dc)>>> EHLO digital-pipe.com
>> > Net::SMTP=GLOB(0x82cd2dc)<<< 250-smtp106.biz.mail.re2.yahoo.com
>> > Net::SMTP=GLOB(0x82cd2dc)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE
>> > Net::SMTP=GLOB(0x82cd2dc)<<< 250-PIPELINING
>> > Net::SMTP=GLOB(0x82cd2dc)<<< 250 8BITMIME

...

> Thanks for the reply. Why would this script work just fine on one
> computer and then stop at the above point on the other?

What script are you talking about? I haven't seen any code in the
messages you have posted so far.

Sinan
--
A. Sinan Unur <1u...@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/

A. Sinan Unur

unread,
May 7, 2008, 3:56:05 PM5/7/08
to
hend...@gmail.com wrote in
news:349ecbfd-844d-440b...@l28g2000prd.googlegroups.com:

[ Posted no code, just error logs ... ]

> The only reason there is an error in the script at line 66 is because
> all the lines were processed even though the auth failed (which the
> script normally wouldn't come to if the auth section that I commented
> out, failed).

So what?

Maybe it was line 666 and that's why it failed.

smallpond

unread,
May 7, 2008, 4:10:05 PM5/7/08
to
>>Thanks for the reply. Why would this script work just fine on one
>>computer and then stop at the above point on the other?
>>
>>Dave

Although my telepathic abilities are limited, I am going to guess
that it is one of:
1 - you are not connecting to the same SMTP server
2 - you have a different version of NET::SMTP
3 - the other computer is configured differently
4 - you are behind a firewall
5 - you are on a different ISP
6 - Comcast is randomly modifying your packets
or
7 - there is a cat inside the computer upgrading your RAM

This line:
250-AUTH LOGIN PLAIN XYMCOOKIE
says that you must authenticate with one of the types: LOGIN, PLAIN or XYMCOOKIE.

hend...@gmail.com

unread,
May 7, 2008, 4:16:22 PM5/7/08
to
On May 7, 3:56 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:

> hende...@gmail.com wrote innews:349ecbfd-844d-440b...@l28g2000prd.googlegroups.com:
>
> [ Posted no code, just error logs ... ]
>
> > The only reason there is an error in the script at line 66 is because
> > all the lines were processed even though the auth failed (which the
> > script normally wouldn't come to if the auth section that I commented
> > out, failed).
>
> So what?
>
> Maybe it was line 666 and that's why it failed.
>
> Sinan
>
> --
> A. Sinan Unur <1...@llenroc.ude.invalid>

> (remove .invalid and reverse each component for email address)
>
> comp.lang.perl.misc guidelines on the WWW:http://www.rehabitation.com/clpmisc/

I would probably say that the script, at this point, is not in
neccessarily in question because it works flawlessly on another
computer. I will post it below however for review:

#!/usr/bin/perl -w
use Net::SMTP;

my $smtp_relay="smtp.bizmail.yahoo.com";
my $port=25;
my $url="digital-pipe.com";
my $username="d...\@digital-pipe.com";
my $password="***";

our ($gbl_logsDir, $gbl_emailLog); #used from called script
my $date = scalar(localtime);

sub send_mail {
my($to_email, $to_name, $from_email, $from_name, $subject, @body) =
@_;

my $smtp = Net::SMTP->new($smtp_relay,
Hello => $url,
Port => $port,
Timeout => 30,
Debug=>1);

open(LOG, ">>$gbl_logsDir/$gbl_emailLog") || die "Can't open
$gbl_logsDir/$gbl_emailLog.";
if ($smtp->auth($username,$password))
{ print LOG "Yahoo! email authentication successful.\n"; }
else
{ print LOG "Authentication failed! No email will be sent.
\n"; return(0); }

...snip...

the rest of the script doesn't get reached because the authentication
fails. The calling script just has a call to the send_mail routine
and that is it. I know it doesn't contain errors, because it works
just fine on another computer. Let me know if there is anything else
you need.

Dave

hend...@gmail.com

unread,
May 7, 2008, 4:20:21 PM5/7/08
to
> > Net::SMTP=GLOB(0x82ccfac)>>> MAIL FROM:<nore...@netbud.local>

> > Net::SMTP=GLOB(0x82ccfac)<<< 530 authentication required - for help go
> > tohttp://help.yahoo.com/help/us/bizmail/pop/pop-11.html

> > Net::SMTP=GLOB(0x82ccfac)>>> RCPT TO:<d...@digital-pipe.com>
> > Net::SMTP: Unexpected EOF on command channel at /usr/lib/perl/5.8/
> > libemail.pm line 66
>
> > The only reason there is an error in the script at line 66 is because
> > all the lines were processed even though the auth failed (which the
> > script normally wouldn't come to if the auth section that I commented
> > out, failed).
>
> > Dave
>
> This line:
> 250-AUTH LOGIN PLAIN XYMCOOKIE
> says that you must authenticate with one of the types: LOGIN, PLAIN or XYMCOOKIE.
>
> --S
> ** Posted fromhttp://www.teranews.com**

I just worked around it by using another SMTP server. Oh well.
Thanks for the help guys.

Dave

Ben Morrow

unread,
May 7, 2008, 4:41:06 PM5/7/08
to
[please don't quote .sigs]

Quoth hend...@gmail.com:


> On May 7, 3:56 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> > hende...@gmail.com wrote
> innews:349ecbfd-844d-440b...@l28g2000prd.googlegroups.com:
> >
> > [ Posted no code, just error logs ... ]
> >
> > > The only reason there is an error in the script at line 66 is because
> > > all the lines were processed even though the auth failed (which the
> > > script normally wouldn't come to if the auth section that I commented
> > > out, failed).
> >
> > So what?
> >
> > Maybe it was line 666 and that's why it failed.
>

> I would probably say that the script, at this point, is not in
> neccessarily in question because it works flawlessly on another
> computer. I will post it below however for review:
>
> #!/usr/bin/perl -w

'use warnings' is preferable to '-w'. You also need 'use strict'.

> use Net::SMTP;
>
> my $smtp_relay="smtp.bizmail.yahoo.com";
> my $port=25;
> my $url="digital-pipe.com";
> my $username="d...\@digital-pipe.com";
> my $password="***";
>
> our ($gbl_logsDir, $gbl_emailLog); #used from called script
> my $date = scalar(localtime);
>
> sub send_mail {
> my($to_email, $to_name, $from_email, $from_name, $subject, @body) =
> @_;
>
> my $smtp = Net::SMTP->new($smtp_relay,
> Hello => $url,
> Port => $port,
> Timeout => 30,
> Debug=>1);
>
> open(LOG, ">>$gbl_logsDir/$gbl_emailLog") || die "Can't open
> $gbl_logsDir/$gbl_emailLog.";

Use lexical filehandles and 3-arg open, and say *why* the open failed:

open my $LOG, '>>', "$gbl_logsDir/$gbl_emailLog"
or die "Can't append to $gbl_logsDir/$gbl_emailLog: $!.";

I much prefer using 'or' and no parens over using '||' and parens on the
'open', but that is a matter of taste.

If you need $LOG to be global (if it's used from other subs), you will
need to declare it at the top with your other globals. It would be
better to have a separate open_log sub which returns a filehandle, and
then pass that filehandle into all the subs which need it.

> if ($smtp->auth($username,$password))
> { print LOG "Yahoo! email authentication successful.\n"; }
> else
> { print LOG "Authentication failed! No email will be sent.
> \n"; return(0); }

You need to log *why* it failed:

else {
printf LOG
"Authentication failed! No email will be sent: %d %s\n",
$smtp->code, $smtp->message;
return(0);
}

I suspect you'll find the result is "500 Need MIME::Base64 and
Authen::SASL todo auth", meaning you haven't got one of those modules
installed.

Ben

--
I must not fear. Fear is the mind-killer. I will face my fear and
I will let it pass through me. When the fear is gone there will be
nothing. Only I will remain.
b...@morrow.me.uk Frank Herbert, 'Dune'

Peter J. Holzer

unread,
May 9, 2008, 2:12:12 AM5/9/08
to
On 2008-05-07 20:10, smallpond <smal...@juno.com> wrote:
> This line:
> 250-AUTH LOGIN PLAIN XYMCOOKIE
> says that you must authenticate with one of the types: LOGIN, PLAIN or XYMCOOKIE.

No, it says that you *can* authenticate using one of these methods.

hp

smallpond

unread,
May 9, 2008, 3:07:16 PM5/9/08
to


The response from the server when Dave tried not authenticating already told us
that you *must* authenticate:

Net::SMTP=GLOB(0x82ccfac)<<< 530 authentication required

So are you suggesting that Dave try to authenticate with a method not from the list?

Peter J. Holzer

unread,
May 11, 2008, 4:46:16 AM5/11/08
to
On 2008-05-09 19:07, smallpond <smal...@juno.com> wrote:
> Peter J. Holzer wrote:
>> On 2008-05-07 20:10, smallpond <smal...@juno.com> wrote:
>>>This line:
>>>250-AUTH LOGIN PLAIN XYMCOOKIE
>>>says that you must authenticate with one of the types: LOGIN, PLAIN or XYMCOOKIE.
>>
>>
>> No, it says that you *can* authenticate using one of these methods.
>
> The response from the server when Dave tried not authenticating already told us
> that you *must* authenticate:
>
> Net::SMTP=GLOB(0x82ccfac)<<< 530 authentication required

You will notice that "250-AUTH LOGIN PLAIN XYMCOOKIE" and "530
authentication required" are not the same message.

The fist means "This server supports the following authentication
methods and you can authenticate yourself using any of them". It doesn't
say that authentication is required, only that it is possible. It may be
the case the authentication is required for some specific operations,
but again, this message doesn't tell you for which. (as a bit of
anectotal evidence, in late 2005 I was collecting statistics about ESMTP
extensions: AUTH was announced by 50 % of the MXs we were sending mail
to - but we could send mail to them just fine, no authentication was
required).

The second message means: "authentication is required for this specific
operation" (probably a RCPT command). This one says that you *must*
authenticate, and the earlier response to EHLO told you which methods
you *can* use.


> So are you suggesting that Dave try to authenticate with a method not from the list?

No. I wasn't suggesting anything to the OP, I was just correcting your
mistaken statement about what the response to EHLO means.

(In fact I haven't seen anything from the OP that indicates that he
tried to authenticate at all, so I'd suggest that he try to authenticate
using a method from the list, but maybe I missed a posting)

hp

0 new messages