Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Feb : Help with Indy sending message to smtp server
| Subject: | Help with Indy sending message to smtp server |
| Posted by: | "Darren Guy" (darren.guy@no.spam.com) |
| Date: | Tue, 15 Feb 2005 18:07:29 |
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