Opens a connection to an SMTP server to verify reachability and (optionally) credentials, the same way cfmail does. Uses the same TLS ladder as cfmail: implicit TLS (useSsl), else STARTTLS (useTls, the default), else plaintext; a requested-but-unavailable TLS is a failure, never a silent downgrade. Returns a struct with success (boolean), authFailed (true when the server rejected the credentials, SMTP 534/535/538) and message (a human-readable detail, empty on success).
smtpConnectionTest(host [, port] [, username] [, password] [, useTls] [, useSsl] [, timeout])
→ returns struct
25truetruefalsefalsetruefalse10Check that an SMTP relay is reachable on port 587.
result = smtpConnectionTest("smtp.example.com", 587);
writeDump(result.success);
A wrong password reports authFailed = true.
result = smtpConnectionTest("smtp.example.com", 587, "user", "wrong", true);
writeDump(result.authFailed);
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.