Sample code for 30+ languages & platforms
PowerBuilder

Verify Connectivity to the SMTP Server

See more SMTP Examples

Demonstrates the Chilkat MailMan.VerifySmtpConnection method, which tests whether a TCP/IP connection can be established with the configured SMTP server. It verifies connectivity only — it does not authenticate. This example configures the SMTP host and checks whether it can be reached.

Background: When a send fails, it helps to know where it broke. VerifySmtpConnection isolates the first hop — can the client even reach the server on the configured host and port, and complete the TLS handshake? A failure here points at networking, firewall, DNS, port, or certificate issues rather than credentials. Once connectivity is confirmed, VerifySmtpLogin tests the authentication step.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Mailman
integer li_Connected

//  Demonstrates the MailMan.VerifySmtpConnection method, which tests whether a TCP/IP
//  connection can be established with the configured SMTP server.  It verifies connectivity
//  only (it does not authenticate).

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

//  Test connectivity to the SMTP server.
li_Connected = loo_Mailman.VerifySmtpConnection()

if li_Connected = 1 then
    Write-Debug "Successfully connected to the SMTP server."
else
    Write-Debug "Could not connect to the SMTP server."
end if



destroy loo_Mailman