|Subject:||Re: Indy 9 and SMTP Authentification|
|Posted by:||Remy Lebeau \(Indy Team\) (re…@lebeausoftware.org)|
|Date:||Wed, 27 Oct 2010|
"Tom Hahn" <tha…@hahntech.com> wrote in message
> I'm confused about how to do login authentication with Indy 9.
What is confusing exactly? You already have the steps needed.
> Assuming that the AuthentificanType is set to atLogon, and
> the UserName and Password are entered, should the following
> code be used (with error handling):
You do not need to call Authenticate() directly. Send() calls it internally
> Should there be a test to see if authenticated after Authenticate?
> Does an authentication failure raise an error?
> Is it possible to use SSL authentication with Indy 9?
Yes, but you have to do most of the work yourself to enable it. Assign a
TIdSSLIOHandlerSocket component to the IOHandler property before calling
Connect(), and make sure the TIdSMTP.UseEHLO property is set to True. Then
try the following code:
TIdSMTPAccess = class(TIdSMTP)
if SMTP.LastCmdResult.Text.IndexOf('STARTTLS') <> -1 then
TIdSSLIOHandlerSocket(SMTP.IOHandler).PassThrough := False;
if Length(SMTP.HeloName) > 0 then begin
NameToSend := SMTP.HeloName;
end else begin
NameToSend := SMTP.LocalName;
if SMTP.SendCmd('EHLO ' + NameToSend) = 250 then begin
SMTP.Authenticate; // <-- optional
Remy Lebeau (Indy Team)
Indy 9 and SMTP Authentification posted by Tom Hahn on Wed, 27 Oct 2010