Discussion:
SMTP components that support SSL
(too old to reply)
Scott Slater
2008-07-08 17:44:13 UTC
Permalink
I've been using Indy 9 in an old Delphi 4 project and I need to add SSL
support to it. The Indy 9 SSL is causing a bunch of errors that lead me to
think that there is a problem with its implementation. Since Indy 10 no
longer supports D4 I think I'm forced to switch to a different SMTP
component that works in D4. It would be easier to find a component that
works with D4 than it would be to upgrade the entire project to D2007 just
to use Indy 10. Anyone know of a SMTP component that supports SSL and works
with D4?
--
Scott Slater
Remy Lebeau (TeamB)
2008-07-08 20:20:58 UTC
Permalink
Post by Scott Slater
The Indy 9 SSL is causing a bunch of errors that lead me to
think that there is a problem with its implementation.
Such as?


Gambit
Scott Slater
2008-07-09 17:23:23 UTC
Permalink
Here is an example of just one of the problems.

My form already has a TIdSMTP component that I use to send emails. This has
been working fine without SSL. To add SSL support I drop a
TIdSSLIOHandlerSocket component on the form and set the IOHandler property
of the TIdSMTP component to point to the TIdSSLIOHandlerSocket component.
If I now simply save and close my project and then reopen the project I get
the following error:

Error creating form. Cannot assign a TfrmEmail to a TIdSocksInfo.

The only way to be able to open the form again is to convert the DFM to TXT
and edit out the object and then convert the TXT back to DFM. BTW, here is
what the object looks like:

object IdSSLIOHandlerSocket1: TIdSSLIOHandlerSocket
SocksInfo = .Owner
SSLOptions.Method = sslvSSLv2
SSLOptions.Mode = sslmUnassigned
SSLOptions.VerifyMode = []
SSLOptions.VerifyDepth = 0
Left = 64
Top = 277
end

My guess is that the SocksInfo = .Owner is not correct.
Any ideas?
--
Scott Slater
Post by Remy Lebeau (TeamB)
Post by Scott Slater
The Indy 9 SSL is causing a bunch of errors that lead me to
think that there is a problem with its implementation.
Such as?
Gambit
Remy Lebeau (TeamB)
2008-07-09 19:40:22 UTC
Permalink
Post by Scott Slater
object IdSSLIOHandlerSocket1: TIdSSLIOHandlerSocket
SocksInfo = .Owner
The SocksInfo property getter creates an unnamed component instance when the
property is read for the first time at design-time. Unnamed component
references do not work with DFM streaming. So, you have two choices:

1) drop a TIdSocksInfo component on the form (even if you are not actually
using SOCKS) and assign it to the property. Then DFM streaming will work
correctly for that property.

2) remove the TIdIOHandlerSocket from the design-time form, and instantiate
it dynamically at run-time instead:

SSL := TIdIOHandlerSocket.Create(SMTP);
SSL.SSLOptions.Method = sslvSSLv2
SSL.SSLOptions.Mode = sslmUnassigned
SSL.SSLOptions.VerifyMode = []
SSL.SSLOptions.VerifyDepth = 0
SMTP.IOHandler := SSL;
Post by Scott Slater
My guess is that the SocksInfo = .Owner is not correct.
Correct. It is retreiving the TIdIOHandlerSocket's Owner, which is the
parent TForm. DFM streaming does not validate component types, so it
happily passes a TfrmEmail pointer to the SocksInfo property setter, which
then raises the exception when TIdSocksInfo.Assign() is called.


Gambit
Scott Slater
2008-07-09 20:35:48 UTC
Permalink
Makes sense, I'll give it a try. I'm fairly sure that I tried adding a
TIdSockInfo component to the form and that did solve the form load problem
but I started getting AV's whenever the form was freed. I'll try the
dynamic method and see what happens.
--
Scott Slater
Post by Remy Lebeau (TeamB)
Post by Scott Slater
object IdSSLIOHandlerSocket1: TIdSSLIOHandlerSocket
SocksInfo = .Owner
The SocksInfo property getter creates an unnamed component instance when
the property is read for the first time at design-time. Unnamed component
1) drop a TIdSocksInfo component on the form (even if you are not actually
using SOCKS) and assign it to the property. Then DFM streaming will work
correctly for that property.
2) remove the TIdIOHandlerSocket from the design-time form, and
SSL := TIdIOHandlerSocket.Create(SMTP);
SSL.SSLOptions.Method = sslvSSLv2
SSL.SSLOptions.Mode = sslmUnassigned
SSL.SSLOptions.VerifyMode = []
SSL.SSLOptions.VerifyDepth = 0
SMTP.IOHandler := SSL;
Post by Scott Slater
My guess is that the SocksInfo = .Owner is not correct.
Correct. It is retreiving the TIdIOHandlerSocket's Owner, which is the
parent TForm. DFM streaming does not validate component types, so it
happily passes a TfrmEmail pointer to the SocksInfo property setter, which
then raises the exception when TIdSocksInfo.Assign() is called.
Gambit
Loading...