PHPackages                             desttools/transmail - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. desttools/transmail

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

desttools/transmail
===================

ZeptoMail Email Client Library for PHP

2.0(1mo ago)24942MITPHPPHP &gt;=8.2

Since Oct 9Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/desttools/transmail)[ Packagist](https://packagist.org/packages/desttools/transmail)[ Docs](https://www.zoho.com/zeptomail/)[ RSS](/packages/desttools-transmail/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)DependenciesVersions (5)Used By (0)

Zoho ZeptoMail API PHP Client
=============================

[](#zoho-zeptomail-api-php-client)

Unofficial PHP client for [Zoho's ZeptoMail](https://www.zoho.com/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](https://www.zoho.com/zeptomail/) for use-case guidelines.

---

Installation
------------

[](#installation)

Install via Composer:

```
composer require desttools/transmail

```

Or add to `composer.json`:

```
"require": {
    "desttools/transmail": "^2.0"
}
```

You can also [clone this repository](https://github.com/desttools/transmail.git) and include the file directly.

---

v2: ZeptoMail\\ZeptoMailClient (PHP 8.0+)
-----------------------------------------

[](#v2-zeptomailzeptomailclient-php-80)

### Setup

[](#setup)

You'll need a **send-mail token** from your ZeptoMail dashboard. A bounce address is optional but recommended.

Set them as environment variables:

```
zeptomailkey=YourSendMailToken
zeptobounceaddr=bounce@bounce.yourdomain.com

```

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:

```
// Direct include:
include_once './transmail/ZeptoMailClient.php';

// Or via Composer autoloading:
include_once './vendor/autoload.php';
```

### Basic Example

[](#basic-example)

```
$msg = new \stdClass();

$msg->subject  = 'My message subject';
$msg->htmlbody = 'My HTML-formatted message';
$msg->textbody = 'My text-only message'; // omit if sending HTML only
$msg->to       = ['joe@customer.com', 'Joe Customer'];
$msg->from     = ['support@site.com', 'XYZ Company'];

$client = new \ZeptoMail\ZeptoMailClient($msg);
$result = $client->send();

if ($result) {
    // success
} else {
    // failure
}
```

### Full Example

[](#full-example)

All available options, including passing credentials directly:

```
$msg = new \stdClass();

// Required
$msg->subject  = 'My message subject';
$msg->htmlbody = 'My HTML-formatted message';
$msg->textbody = 'My text-only message';
$msg->to       = ['joe@customer.com', 'Joe Customer'];
$msg->from     = ['support@site.com', 'XYZ Company'];

// Optional
$msg->reply_to         = ['address@site.com', 'XYZ Company'];
$msg->cc               = ['address2@site.com', 'Someone'];
$msg->bcc              = ['address3@site.com', 'Somebody Else'];
$msg->track_clicks     = true;
$msg->track_opens      = true;
$msg->client_reference = null; // arbitrary string, passed through to API
$msg->mime_headers     = null; // array of additional MIME headers
$msg->attachments      = null; // array — see Attachments section
$msg->inline_images    = null; // array

// Pass API key and bounce address directly (overrides env vars)
$client = new \ZeptoMail\ZeptoMailClient($msg, 'myapikey', 'mybounce@address.com');
$result = $client->send();
```

### Multiple Recipients

[](#multiple-recipients)

`to`, `cc`, and `bcc` each accept either a single `['email', 'name']` pair or an array of such pairs:

```
$msg->to = [
    ['alice@example.com', 'Alice'],
    ['bob@example.com',   'Bob'],
];
```

### Address Formatting

[](#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:

```
$msg->to = 'joe@customer.com';
// or
$msg->to = ['joe@customer.com', 'Joe Customer'];
// or — order doesn't matter, email is detected by format:
$msg->to = ['Joe Customer', 'joe@customer.com'];
```

### Error Handling

[](#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**.

```
$client = new \ZeptoMail\ZeptoMailClient($msg, 'myapikey', null, true);
$result = $client->send(); // stdClass API response object

// Reference for API error codes:
// https://www.zoho.com/zeptomail/help/api/error-codes.html
```

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

[](#additional-mime-headers)

```
$msg->mime_headers = [
    ['CustId'   => '1234',
     'CustName' => 'Bob Smith'],
];
```

### Attachments

[](#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:

```
$attachments = [];

$file     = 'filename.jpg';
$path     = '/path/to/' . $file;
$filedata = file_get_contents($path);

if ($filedata) {
    $attachments[] = [
        'content'   => base64_encode($filedata),
        'mime_type' => mime_content_type($path),
        'name'      => $file,
    ];
}

$msg->attachments = $attachments;
```

[List of attachment types unsupported by ZeptoMail](https://www.zoho.com/zeptomail/help/file-cache.html#alink-un-sup-for)

---

v1: Transmail\\TransmailClient (legacy)
---------------------------------------

[](#v1-transmailtransmailclient-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\ZeptoMailClient` above.
>
> If you are upgrading from v1, see the [migration notes](#migrating-from-v1-to-v2) below.

### Setup (v1)

[](#setup-v1)

```
transmailkey=YourAPIkey
transbounceaddr=bounce@bounce.yourdomain.com

```

```
include_once './transmail/TransmailClient.php';
// or: include_once './vendor/autoload.php';
```

### Basic Example (v1)

[](#basic-example-v1)

```
$msg = new \stdClass();

$msg->subject  = 'My message subject';
$msg->textbody = 'My text-only message';
$msg->htmlbody = 'My HTML-formatted message';
$msg->to       = ['joe@customer.com', 'Joe Customer'];
$msg->from     = ['support@site.com', 'XYZ Company'];

$tmail  = new \Transmail\TransmailClient($msg);
$result = $tmail->send();
```

### Full Example (v1)

[](#full-example-v1)

```
$msg = new \stdClass();

$msg->subject         = 'My message subject';
$msg->textbody        = 'My text-only message';
$msg->htmlbody        = 'My HTML-formatted message';
$msg->to              = ['joe@customer.com', 'Joe Customer'];
$msg->from            = ['support@site.com', 'XYZ Company'];
$msg->reply_to        = ['address@site.com', 'XYZ Company'];
$msg->cc              = ['address2@site.com', 'Someone'];
$msg->bcc             = ['address3@site.com', 'Somebody Else'];
$msg->track_clicks    = true;
$msg->track_opens     = true;
$msg->client_reference = null;
$msg->mime_headers    = null;
$msg->attachments     = null;
$msg->inline_images   = null;

$tmail  = new \Transmail\TransmailClient($msg, 'myapikey', 'mybounce@address.com', true);
$result = $tmail->send();
```

---

Migrating from v1 to v2
-----------------------

[](#migrating-from-v1-to-v2)

v1v2**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 supportedPass an array of `['email', 'name']` pairs**Bounce address**RequiredOptionalMessage field names (`subject`, `htmlbody`, `to`, `from`, etc.) are identical between versions.

---

SMTP
----

[](#smtp)

This library only sends through the ZeptoMail HTTP API. For SMTP relay, consult your mail server's documentation or the [ZeptoMail SMTP docs](https://www.zoho.com/zeptomail/help/introduction.html).

---

### [ZeptoMail API Documentation](https://www.zoho.com/zeptomail/help/introduction.html)

[](#zeptomail-api-documentation)

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance92

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1028 days

Total

3

Last Release

38d ago

Major Versions

v1.1 → 2.02026-05-27

PHP version history (2 changes)v1.0PHP ^5.6.0 || ^7.0

2.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/48933204?v=4)[Destination Toolbox](/maintainers/desttools)[@desttools](https://github.com/desttools)

---

Top Contributors

[![desttools](https://avatars.githubusercontent.com/u/48933204?v=4)](https://github.com/desttools "desttools (25 commits)")

---

Tags

transactional-emailstransmail-apizoho-transmail-serviceemailZohodeliverabilityzeptomailtransmail

### Embed Badge

![Health badge](/badges/desttools-transmail/health.svg)

```
[![Health](https://phpackages.com/badges/desttools-transmail/health.svg)](https://phpackages.com/packages/desttools-transmail)
```

###  Alternatives

[egulias/email-validator

A library for validating emails against several RFCs

11.7k734.8M443](/packages/egulias-email-validator)[sendgrid/sendgrid

This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.

1.6k50.9M190](/packages/sendgrid-sendgrid)[pelago/emogrifier

Converts CSS styles into inline style attributes in your HTML code

94746.7M138](/packages/pelago-emogrifier)[zbateson/mail-mime-parser

MIME email message parser

54753.3M90](/packages/zbateson-mail-mime-parser)[soundasleep/html2text

A PHP script to convert HTML into a plain text format

48021.2M91](/packages/soundasleep-html2text)[opcodesio/mail-parser

Parse emails without the mailparse extension

228.8M11](/packages/opcodesio-mail-parser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
