Download the PHP package desttools/transmail without Composer
On this page you can find all versions of the php package desttools/transmail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download desttools/transmail
More information about desttools/transmail
Files in desttools/transmail
Package transmail
Short Description ZeptoMail Email Client Library for PHP
License MIT
Homepage https://www.zoho.com/zeptomail/
Informations about the package transmail
Zoho ZeptoMail API PHP Client
Unofficial PHP client for Zoho's ZeptoMail transactional email API.
ZeptoMail is intended for transactional emails triggered by website or app interactions (receipts, password resets, 2FA notices, etc.), not bulk campaigns or newsletters. See the ZeptoMail site for use-case guidelines.
Installation
Install via Composer:
Or add to composer.json:
You can also clone this repository and include the file directly.
v2: ZeptoMail\ZeptoMailClient (PHP 8.0+)
Setup
You'll need a send-mail token from your ZeptoMail dashboard. A bounce address is optional but recommended.
Set them as environment variables:
Or pass them directly to the constructor (see examples below).
Note: The sender domain must be verified in your ZeptoMail dashboard before messages will be accepted.
Load the library:
Basic Example
Full Example
All available options, including passing credentials directly:
Multiple Recipients
to, cc, and bcc each accept either a single ['email', 'name'] pair or an array of such pairs:
Address Formatting
Addresses can be passed as a plain string or as an array. When an array is used, the library detects which element is the email address and uses the other as the display name:
Error Handling
By default, send() returns true on success and false on failure.
Pass true as the fourth constructor argument to enable verbose mode. In verbose mode, send() returns the full API response object on API calls (success or failure), or an error string if the cURL request itself fails. This is useful for debugging but may expose sensitive account information — disable it in production.
The constructor throws \InvalidArgumentException if no API key can be found (neither passed directly nor set as zeptomailkey in the environment), or if subject, from, or to are missing from the message.
Additional MIME Headers
Attachments
The library passes attachment data through to the API as-is. Please note that ZeptoMail has a 15MB weight limit for all attachments. Build the attachment array yourself, base64-encoding the file content:
List of attachment types unsupported by ZeptoMail
v1: Transmail\TransmailClient (legacy)
v1 is no longer actively maintained. It continues to work but does not receive bug fixes or new features. New projects should use
ZeptoMail\ZeptoMailClientabove.If you are upgrading from v1, see the migration notes below.
Setup (v1)
Basic Example (v1)
Full Example (v1)
Migrating from v1 to v2
| v1 | v2 | |
|---|---|---|
| File | TransmailClient.php |
ZeptoMailClient.php |
| Namespace / class | Transmail\TransmailClient |
ZeptoMail\ZeptoMailClient |
| Composer | desttools/transmail:^1.0 |
desttools/transmail:^2.0 |
| API key env var | transmailkey |
zeptomailkey |
| Bounce env var | transbounceaddr |
zeptobounceaddr |
| No API key found | Returns false / error string (silently ignored) |
Throws \InvalidArgumentException |
| Multiple recipients | Not supported | Pass an array of ['email', 'name'] pairs |
| Bounce address | Required | Optional |
Message field names (subject, htmlbody, to, from, etc.) are identical between versions.
SMTP
This library only sends through the ZeptoMail HTTP API. For SMTP relay, consult your mail server's documentation or the ZeptoMail SMTP docs.