Hi,

I was in trouble with Net::SMTP like you and discovered that the error was
in the sequence you submit the methods.
The right sequence that worked fine is to "authorize" as soon as you create
the new connection.


use Net::SMTP;
$smtp = Net::SMTP->new('yoursmtpmailserver.domain.com' );
$smtp->auth ( '[EMAIL PROTECTED]',  'password' );
$smtp->mail('[EMAIL PROTECTED]');
$smtp->to('[EMAIL PROTECTED]');
$smtp->data();
$smtp->datasend("To: [EMAIL PROTECTED]");
$smtp->datasend("\n");
$smtp->datasend("Your message comes here....\n");
$smtp->dataend();
$smtp->quit;

Josimar Nunes de Oliveira


----- Original Message ----- 
From: "George Schlossnagle" <[EMAIL PROTECTED]>
To: "awards" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, August 09, 2003 7:24 PM
Subject: Re: smtp problem


> Sounds like the server you are connecting to does not allow relaying.
> Is this a server you should be relaying mail through?
>
> George
>
> On Saturday, August 9, 2003, at 06:16  PM, awards wrote:
>
> > Hi,
> >
> > I found a strange problem.
> > like the subject says i'm using Net::SMTP
> > I don't have any error in my code.
> >
> > But when I'm using a server i.e mail.xxx.com
> > Only domain @xxx.com will receive an e-mail.
> > if I send an email at @aaa.com with the mail.xxx.com then it will not
> > get
> > the mail but if i change the server to aaa.com then i will get an
> > email at
> > @aaa.com but not @xxx.com.
> >
> > Here is the Code i'm using  to send mail
> >
> > $msg = MIME::Lite->new(
> >     From => "$MailFrom",
> >     To => "$MailTo",
> >     Subject => "$Subject",
> >     Type => 'text/html',
> >     Data => "$Message"
> > );
> >
> > $str = $msg->as_string;
> > &die("Can't connect") unless $smtp = Net::SMTP->new($server);
> > $smtp->mail($MailFrom);
> > $smtp->to($MailTo);
> > $smtp->data();
> > $smtp->datasend("$str");
> > $smtp->dataend();
> > $smtp->quit();
> >
> >
> > awards
> >
> >
> >
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> -- George Schlossnagle
> -- Principal Consultant
> -- OmniTI Computer Consulting, Inc.
> -- +1.410.872.4910 x202
> -- 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E  56C2 B2B9 262F 1100 A5A0
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to