🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #465

Indy SMTP and TLS options

#465
From: BrianV
Date: Sat, 23 Feb 2008 02:57
69 lines
3178 bytes
Hi,
I'm having some real issues getting indy 10 to work for a commercial app I'm 
working on.  Here's one of them:

I'm using indy 10.1.5, the version that ships with C++ Builder 2007.

First off, the definitions of utUseExplicitTLS, utUseImplicitTLS, 
utUseRequireTLS, and utNoTLSSupport aren't very clear to me.  Can someone 
explain in any detail what these options would be used for, and where I 
could read more about them.  The stuff I find on Google is 
hazy/contradictory.

Also, the implementation is confusing as well.  In my version of Indy, the 
code that sets these options looks like (in 
IdExplicitTLSClientServerBase.pas, line 399):

procedure TIdExplicitTLSClient.SetUseTLS(AValue: TIdUseTLS);
begin
  if not Connected then
  begin
    if IsLoading then
    begin
      FUseTLS := AValue;
      exit;
    end;
    if (AValue<>utNoTLSSupport) then
    begin
      CheckIfCanUseTLS;
    end;
    if FUseTLS <> AValue then                       (B)
    begin
      if AValue=utUseImplicitTLS then
      begin
        if Port = FRegularProtPort then
        begin
          Port := FImplicitTLSProtPort;
        end;
      end
      else
      begin
        if Port = FImplicitTLSProtPort then
        begin
          Port := FRegularProtPort;                   (A)
        end;
      end;
      FUseTLS := AValue;
    end;
  end
  else
  begin
    raise 
EIdTLSClientCanNotSetWhileConnected.Create(RSTLSSLCanNotSetWhileConnected);
  end;
end;

If you set the value to utUseRequireTLS, then, the code changes your Port 
value to FRegularProtPort (which is defined as 25) at point A.  Further, the 
behavior of this method is dependent on the order in which you call things. 
For example if you set your port first, it will get changed to 25.  If you 
set your port after setting TLS option, it stays the same.  In addition, if 
you call this method twice, setting the same value each time (something 
there shouldn't be anything wrong with) it behaves totally different the 
second time you call it because of the check at point (B).

If anyone has been able to get a TIdSMTP component in indy 10 to work right 
with the TLS options, I'd love to hear of any tricks.

Thanks,
Brian 
Technical Details
Message-ID: <47bf8bb4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,ac02878589379fbf,start
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "BrianV" <bvanmatre_remove_@yahoo.com>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Indy SMTP and TLS options
Date: Fri, 22 Feb 2008 19:57:56 -0700
Lines: 71
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 24.9.114.34
Message-ID: <47bf8bb4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1203735476 24.9.114.34 (22 Feb 2008 18:57:56 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail