DataFlex
DataFlex
Explicitly Connect to the SMTP Server
See more SMTP Examples
Demonstrates the Chilkat MailMan.SmtpConnect method, which explicitly connects to the SMTP server. If SSL/TLS is required by the current property settings, the secure TLS channel is established as part of connecting. This example opens the connection.
Background:
SmtpConnect performs just the connect (and TLS handshake) step, without authenticating — useful when you want fine-grained control over the connection lifecycle, or to separate connecting from authenticating (SmtpAuthenticate) for diagnostics. For everyday sending you don't need to call it: SendEmail connects automatically.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMailman
String sTemp1
Move False To iSuccess
// Demonstrates the MailMan.SmtpConnect method, which explicitly connects to the SMTP server.
// If SSL/TLS is required by the current property settings, the secure channel is established
// as part of connecting.
Get Create (RefClass(cComChilkatMailMan)) To hoMailman
If (Not(IsComObjectCreated(hoMailman))) Begin
Send CreateComObject of hoMailman
End
// Configure the SMTP server connection.
Set ComSmtpHost Of hoMailman To "smtp.example.com"
Set ComSmtpPort Of hoMailman To 465
Set ComSmtpSsl Of hoMailman To True
// Explicitly connect to the SMTP server (does not authenticate).
Get ComSmtpConnect Of hoMailman To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Connected to the SMTP server."
End_Procedure