Sample code for 30+ languages & platforms
PowerBuilder

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 PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Mailman
integer li_DsnCapable

//  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.

loo_Mailman = create oleobject
li_rc = loo_Mailman.ConnectToNewObject("Chilkat.MailMan")
if li_rc < 0 then
    destroy loo_Mailman
    MessageBox("Error","Connecting to COM object failed")
    return
end if

//  Configure the SMTP server connection.
loo_Mailman.SmtpHost = "smtp.example.com"
loo_Mailman.SmtpPort = 465
loo_Mailman.SmtpSsl = 1
loo_Mailman.SmtpUsername = "user@example.com"
loo_Mailman.SmtpPassword = "myPassword"

//  Check whether the server supports DSN.
li_DsnCapable = loo_Mailman.IsSmtpDsnCapable()

if li_DsnCapable = 1 then
    Write-Debug "The SMTP server supports DSN."
else
    Write-Debug "The SMTP server does not support DSN."
end if

//  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.


destroy loo_Mailman