Client libraries
Official client libraries
Duva publishes and maintains a library for Node.js, one for Python, one for Ruby, one for Go and one for PHP: sending, events, suppressions, webhooks and statistics, with the same retries and error handling as the API.
Languages covered
-
Node.js
Supported with no required dependency. Written in TypeScript, published as both ESM and CommonJS.
npm install duva-mailimport { Duva } from "duva-mail";https://www.npmjs.com/package/duva-mail · https://github.com/duva-mail/duva-node
-
Python
Synchronous and asynchronous client, fully typed (`mypy --strict`, `py.typed`).
pip install duva-mailfrom duva import Duvahttps://pypi.org/project/duva-mail/ · https://github.com/duva-mail/duva-python
-
Ruby
No gem dependency (`Net::HTTP`), immutable value objects (Ruby 3.2 or later).
gem install duva-mailrequire "duva"https://rubygems.org/gems/duva-mail · https://github.com/duva-mail/duva-ruby
-
Go
No external dependency (`net/http`), pagination via `iter.Seq2` (Go 1.23 or later).
go get github.com/duva-mail/duva-goimport "github.com/duva-mail/duva-go"https://pkg.go.dev/github.com/duva-mail/duva-go · https://github.com/duva-mail/duva-go
-
PHP
PSR-18 (Guzzle by default, injectable), `readonly` value objects (PHP 8.2 or later).
composer require duva-mail/duvause Duva\Client;https://packagist.org/packages/duva-mail/duva · https://github.com/duva-mail/duva-php
Open source (MIT license); each library is tested against the same conformance suite as the server.
WordPress plugin
Duva Mail sends all the emails of your WordPress site (WooCommerce orders, contact forms, password resets) through the Duva API: it replaces the transport of wp_mail() and changes nothing else on your site.
- Works with anything that sends through
wp_mail(): To, Cc, Bcc, names, attachments and common headers. - No silent fallback: if Duva cannot take an email, the failure is returned to WordPress and shown in the plugin settings.
- Safe retries thanks to an idempotency key: a network timeout never creates a duplicate.
- The API key can stay out of the database, in
wp-config.php(DUVA_MAIL_API_KEY). No telemetry.
You need a Duva account with a verified domain and an API key created for that domain. Installation: Plugins, Add New, search for "Duva Mail", activate, then Settings, Duva Mail. Requires WordPress 5.9 or later and PHP 7.4 or later.
The plugin interface is in English for now; the French translation is awaiting approval.
Integrations
To send through Duva without writing an API call: these packages plug Duva into your framework's mail system.
-
Laravel
Mail transport for Laravel 12 and 13: Mailables and notifications go out through the API, with tags, metadata, attachments, Cc and Bcc, and Laravel's `failover` mailer.
composer require duva-mail/laravelMAIL_MAILER=duvahttps://packagist.org/packages/duva-mail/laravel · https://github.com/duva-mail/duva-laravel
-
Django
Email backend for Django 5.2 and later (including Django 6.1's `MAILERS` setting): `send_mail()` and `EmailMessage` go out through the API, with attachments, Cc and Bcc.
pip install duva-djangoEMAIL_BACKEND = "duva_django.EmailBackend"https://pypi.org/project/duva-django/ · https://github.com/duva-mail/duva-django
-
n8n
Community node for n8n: send email (attachments, Cc and Bcc, idempotency key), read delivery events and manage the suppression list.
npm install n8n-nodes-duvan8n: Settings > Community nodes > n8n-nodes-duvahttps://www.npmjs.com/package/n8n-nodes-duva · https://github.com/duva-mail/duva-n8n
-
Rails
Action Mailer delivery method for Rails 7.2 and later: mailers, `deliver_later` and Devise emails go out through the API, with attachments, Cc and Bcc, tags and metadata.
bundle add duva-railsconfig.action_mailer.delivery_method = :duvahttps://rubygems.org/gems/duva-rails · https://github.com/duva-mail/duva-rails
-
Nodemailer
Nodemailer transport for Node.js 22 and later: `sendMail()` goes out through the API, with attachments, Cc and Bcc, tags, metadata and an idempotency key.
npm install nodemailer-duvanodemailer.createTransport(duvaTransport({ domain: "example.com" }))https://www.npmjs.com/package/nodemailer-duva · https://github.com/duva-mail/duva-nodemailer
-
Symfony
Symfony Mailer transport for Symfony 6.4, 7 and 8: `MailerInterface` and Messenger send through the API, with attachments, Cc and Bcc, tags and metadata.
composer require duva-mail/symfony-mailerMAILER_DSN=duva://KEY@default?domain=example.comhttps://packagist.org/packages/duva-mail/symfony-mailer · https://github.com/duva-mail/duva-symfony
Another language
No official library is required to use Duva: the API is a plain JSON `POST`. The OpenAPI specification lets you generate a full client in the language of your choice, and the API reference gives working examples in Node.js, Python, PHP, Go and Ruby.