pg_utl_smtp 2.0 adds async mode and TLS for PostgreSQL email
The Oracle-compatible PostgreSQL extension pg_utl_smtp reaches version 2.0 with asynchronous email sending, SSL/TLS support, and stricter SMTP error handling.
Summary
HexaCluster has released pg_utl_smtp 2.0, a PostgreSQL extension that replicates Oracle's UTL_SMTP package for sending email from database triggers and stored procedures. The new major version introduces an asynchronous mode not present in Oracle's original, enabling easier porting of Microsoft SQL Server's sp_send_dbmail() procedure. The release also adds SSL/TLS connections, fixes duplicate EHLO commands, and raises errors on SMTP server failures during key protocol stages.
What's new in pg_utl_smtp 2.0
- Asynchronous mode: New
pg_utl_smtp.asynchronoussetting enables non-blocking email sends, useful for MSSQLsp_send_dbmail()migrations - SSL/TLS support: New
secure_connection_before_smtpparameter for encrypted connections - Stricter error handling: SMTP errors during HELO/EHLO, MAIL, RCPT, DATA, end-of-DATA, or QUIT now raise PostgreSQL errors instead of failing silently
- Connection fixes: Eliminated duplicate EHLO at connection start; QUIT now properly releases connection with error on duplicate calls
- Improved diagnostics: Connection failures now emit WARNING with specific reason
- Testing: GitHub Actions regression tests added
- Upgrade path:
ALTER EXTENSION pg_utl_smtp UPDATEfor existing installations
Why it matters
The extension targets organizations migrating from Oracle or SQL Server to PostgreSQL, reducing friction for database-driven notification systems that previously relied on proprietary email APIs. The asynchronous mode addresses a common performance concern in high-volume trigger-based alerting.
Original reference: www.postgresql.org →