I am using the indy components to implement emails in a delphi application. I am specifically using the TidSMTP component. I need to effectively support all major email servers. I use Mozilla Thunderbird as my email client and am comparing the smtp properties with those in the TidSMTP component. I have attempted to find documentation that describes the relationship between the TidSMTP properties, but have not been able to figure it out.
Can someone explain how these compare and what they do:
- In Thunderbird:Connection Security: (None, STARTTLS, SSL/TLS).
-
In TidSMTP.UseTLS (utNoTLSSupport, utUseImplicitTLS, utUseRequireTLS, utUseExplicitTLS)
-
In Thunderbird:Authentication method: (No Authentication, Normal Password, Encrypted Password, Kerberos/GSSAPI, NTLM)
- In TidSMTP (username, password, with useAuthentication method)
I also see other TidSMTP properties: UseEhlo, UseVerp, UseNagle. Do I need to be using these? What do they do?
When using
STARTTLS, the server’s listening port is initially unencrypted upon connecting. When a client connects, it can send an optionalSTARTTLScommand to the server, if the server supports it, to dynamically perform the SSL/TLS handshake at that time. This allows legacy non-SSL/TLS clients to continue connecting to that same port, while allowing newer SSL/TLS-enabled clients to use SSL/TLS if available on the server. This corresponds toUseTLS=utUseExplicitTLSin Indy. You need to setUseEHLOto True in order to useUseTLS=utUseExplicitTLS, as theEHLOcommand is howTIdSMTPdiscovers whether the server supports theSTARTTLScommand or not.When using
SSL/TLSinstead ofSTARTTLS, the server’s listening port is always using encryption and the client must initiate the SSL/TLS handshake immediately upon connecting before any other data can be exchanged. This corresponds toUseTLS=utUseImplicitTLSin Indy. There is noSTARTTLScommand used.For authentication,
TIdSMTPhas two options – the old (and unsecure)AUTH LOGINcommand that is defined by the original SMTP spec, and SMTP extensions for SASL-based hashing/encryption algorithms (Kerberos, GSSAPI, NTLM, etc are implemented as SASL algorithms).To use SASL, set
TIdSMTP.AuthTypetosatSASLand then fill in theTIdSMTP.SASLMechanismscollection to point at separateTIdSASL-derived components for the algorithms you want to support in your app. Indy has native SASL components forDIGEST-MD5,CRAM-MD5,CRAM-SHA1,NTLM(experimental),ANONYMOUS,EXTERNAL,OTP,PLAIN,SKEY, andLOGIN(SASL wrapper forAUTH LOGIN). If you need another algorithm (Kerberos or GSSAPI, for instance), you will have to write your ownTIdSASL-derived component. For algorithms that use Username/Password, the values must be assigned to a separateTIdUserPassProvidercomponent that is then assigned to the SASL components (theTIdSMTP.UserNameandTIdSMTP.Passwordproperties are not used with SASL). The more SASL algorithms you support, the wider the number of servers you will be able to support.For servers that still support
AUTH LOGIN, it can be used either by settingTIdSMTP.AuthTypetosatDefault(and optionally settingTIdSMTP.ValidateAuthLoginCapabilityto False if the server supportsAUTH LOGINbut does not report it in response to theEHLOcommand) and then filling in theTIdSMTP.UserNameandTIdSMTP.Passwordproperties, or by including theTIdSASLLogincomponent in theTIdSMTP.SASLMechanismscollection.UseVerpandUseNaglehave nothing to do with security.VERPis an SMTP extension for detecting bouncing emails due to undeliverable errors. Nagle is a networking algorithm for optimizing network data packets.