PureBasic
PureBasic
Check if the SMTP Server Supports DSN
See more SMTP Examples
Demonstrates the Chilkat MailMan.IsSmtpDsnCapable method, which contacts the SMTP server and determines whether it supports the DSN (Delivery Status Notification) extension defined by RFC 3461. This example configures the SMTP connection and reports whether DSN is available.
Background: DSN lets a sender request a delivery receipt — asking the mail system to report back on success, failure, or delay for each recipient. Not every server offers it, so
IsSmtpDsnCapable probes the server's advertised EHLO capabilities first. Checking before relying on DSN-related settings avoids surprises when a server silently ignores a receipt request it does not support.Chilkat PureBasic Downloads
IncludeFile "CkMailMan.pb"
Procedure ChilkatExample()
; Demonstrates the MailMan.IsSmtpDsnCapable method, which contacts the SMTP server and
; determines whether it supports the DSN (Delivery Status Notification) extension defined
; by RFC 3461.
mailman.i = CkMailMan::ckCreate()
If mailman.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Configure the SMTP server connection.
CkMailMan::setCkSmtpHost(mailman, "smtp.example.com")
CkMailMan::setCkSmtpPort(mailman, 465)
CkMailMan::setCkSmtpSsl(mailman, 1)
CkMailMan::setCkSmtpUsername(mailman, "user@example.com")
CkMailMan::setCkSmtpPassword(mailman, "myPassword")
; Check whether the server supports DSN.
dsnCapable.i = CkMailMan::ckIsSmtpDsnCapable(mailman)
If dsnCapable = 1
Debug "The SMTP server supports DSN."
Else
Debug "The SMTP server does not support DSN."
EndIf
; Note: Explicitly connecting/authenticating is optional. Chilkat MailMan automatically
; connects and authenticates -- using the property settings above -- whenever a server
; operation requires it. Calling the explicit connect/authenticate methods can still be
; helpful to determine whether a failure occurs while connecting or while authenticating.
CkMailMan::ckDispose(mailman)
ProcedureReturn
EndProcedure