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

Help with Indy sending message to smtp server

503 views
Skip to first unread message

Darren Guy

unread,
Feb 15, 2005, 1:07:29 PM2/15/05
to
I am trying to connect to an SMTP server using the Indy components in Delphi
7, The following is code snippet that I am using to connect to the SMTP
server, cant remember where I got it from.


if ( idSMTP.Connected ) then // if already connected, then disconnect from
the
IdSMTP.Disconnect; // SMTP server
IdSMTP.Host := fHostName;
IdSMTP.Port := 25;
try
IdSMTP.Connect();
if ( IdSMTP.Connected ) then
begin
if ( IdSMTP.AuthSchemesSupported.IndexOf('LOGIN') <> -1 )then
begin
IdSMTP.Username := UserName;
IdSMTP.Password := Password;
IdSMTP.AuthenticationType:=atLogin;
if ( IdSMTP.Authenticate = false ) then
begin
fErrorMessage := 'SMTP validation lost.';
IdSMTP.Disconnect;
exit;
end;
end;
end;
except
on E: Exception do
begin
fErrorMessage := 'Failed to connect to SMTP server'#13#10 + e.Message;
exit;
end;
end;

When it gets to IdSMTP.Authenticate = false I am getting the following
error:

EIdProtocolReplyError with message 'authentication failed - incorrect
username/password.'

When I telnet into the SMTP server I can connect and send test messages
successfully.

For the username and password I have tried both blank, with username my
network login I and password, and username = domain username, with my
correct password. I always get the EidProtocolReplyError being raised.

If I comment out the block of code for Authenticate, then I stop getting the
error, but no message is received

Is there something simple that I have missed?
thanks in advance


Darren


Remy Lebeau (TeamB)

unread,
Feb 15, 2005, 1:34:55 PM2/15/05
to

"Darren Guy" <darre...@no.spam.com> wrote in message
news:42123a61$1...@newsgroups.borland.com...

> When it gets to IdSMTP.Authenticate = false I am getting
> the following error:
>
> EIdProtocolReplyError with message 'authentication failed - incorrect
> username/password.'
>
> When I telnet into the SMTP server I can connect and send test
> messages successfully.

Did you MIME-encode the values when using Telnet? TIdSMTP does.

Did you try using a packet sniffer to see what exactly is different between
your manual commands and TIdSMTP's commands?


Gambit


Darren Guy

unread,
Feb 16, 2005, 6:27:57 AM2/16/05
to
Did a packet trace, and in the telnet connection it is not issuing the
command AUTH LOGIN

So I altered my code to not do any login information, and did another trace
capture. Both packet captures appear the same to me.

"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:42123ff0$1...@newsgroups.borland.com...

Ciaran Costelloe

unread,
Feb 16, 2005, 7:00:28 AM2/16/05
to

"Darren Guy" <darre...@no.spam.com> wrote in message
news:4213...@newsgroups.borland.com...

> Did a packet trace, and in the telnet connection it is not issuing the
> command AUTH LOGIN
>
> So I altered my code to not do any login information, and did another
> trace capture. Both packet captures appear the same to me.

So your program is now able to send emails properly?

Many SMTP servers don't require you to log on, they are authorising you
based on your IP address.

Ciaran


Remy Lebeau (TeamB)

unread,
Feb 16, 2005, 1:40:49 PM2/16/05
to

"Darren Guy" <darre...@no.spam.com> wrote in message
news:4213...@newsgroups.borland.com...

> Did a packet trace, and in the telnet connection it is
> not issuing the command AUTH LOGIN

Telnet will send whatever you type in yourself. If you do not type in AUTH
LOGIN yourself, then it will not be sent.

> So I altered my code to not do any login information, and did
> another trace capture. Both packet captures appear the same to me.

And does the problem still persist?

Also, did you configure Outlook with a username/password in the first place?
Did it ever send the AUTH LOGIN command?


Gambit


Remy Lebeau (TeamB)

unread,
Feb 16, 2005, 1:42:15 PM2/16/05
to

"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:421392d1$1...@newsgroups.borland.com...

> Also, did you configure Outlook with a username/password
> in the first place? Did it ever send the AUTH LOGIN command?

Ignore that part, I was thinking of a different discussion elsewhere.


Gambit


Darren Guy

unread,
Feb 17, 2005, 6:24:16 AM2/17/05
to
Found the problem,

There was nothing wrong with the code, tracked the problem down to Surf
Control on our mail server, it was identifying my test messages as spam, and
was holding them for review.

Working with our systems team to get around it

Darren


0 new messages