# pg_utl_smtp 2.0 adds async mode and TLS for PostgreSQL email

> **Key takeaway:** The Oracle-compatible PostgreSQL extension pg_utl_smtp reaches version 2.0 with asynchronous email sending, SSL/TLS support, and stricter SMTP error handling.

**Published:** 2026-10-18T00:00:00+00:00 
**Source:** PostgreSQL Official News 
**Category:** databases-storage 
**Canonical URL:** https://fosswire.org/news/pgutlsmtp-20-adds-async-mode-and-tls-for-postgresql-email.html 

## 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.asynchronous` setting enables non-blocking email sends, useful for MSSQL `sp_send_dbmail()` migrations
- **SSL/TLS support**: New `secure_connection_before_smtp` parameter 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 UPDATE` for 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.