PHPackages                             open-php/zoho-mail - 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. open-php/zoho-mail

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

open-php/zoho-mail
==================

A lightweight PHP wrapper for sending mail via Zoho using PHPMailer

1.0.1(3mo ago)03MITPHPPHP &gt;=7.2

Since Nov 29Pushed 3mo agoCompare

[ Source](https://github.com/mrsandipmandal/zoho-mail)[ Packagist](https://packagist.org/packages/open-php/zoho-mail)[ Docs](https://github.com/mrsandipmandal/zoho-mail)[ RSS](/packages/open-php-zoho-mail/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (3)Used By (0)

Zoho Mail SMTP PHPMailer
========================

[](#zoho-mail-smtp-phpmailer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/364c3bee3bbf3798311ad91be2a56d949ca7c110e36be509f3e7dd445a016a17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70656e2d7068702f7a6f686f2d6d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/open-php/zoho-mail)[![Total Downloads](https://camo.githubusercontent.com/4c5a4c31baf181469335b791b54c3acac380d25666761cebd1583defefe3e2b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f70656e2d7068702f7a6f686f2d6d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/open-php/zoho-mail)[![License](https://camo.githubusercontent.com/f368265c1c4e2462b783ed0b3537e5d87285ac89c08bc10dfed4fe1d315a76d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f70656e2d7068702f7a6f686f2d6d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/open-php/zoho-mail)

A clean, reusable PHP class wrapper for sending emails via Zoho Mail SMTP using PHPMailer. Perfect for applications requiring reliable email delivery with support for attachments, templates, and multiple recipients.

Features
--------

[](#features)

- ✅ **Zoho Mail Integration** — Configured for Zoho's India region (`smtp.zoho.in:587`)
- ✅ **Fluent Interface** — Chain methods for clean, readable code
- ✅ **File Attachments** — Attach files to emails easily
- ✅ **Template Support** — Load HTML/text templates with variable replacement
- ✅ **Multiple Recipients** — Add To, CC, and BCC recipients
- ✅ **Debug Mode** — Toggle SMTP debug output for troubleshooting
- ✅ **Error Handling** — Comprehensive exception handling and error messages
- ✅ **2FA Support** — Works with Zoho App Passwords for accounts with 2FA enabled

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

[](#installation)

### Prerequisites

[](#prerequisites)

- PHP 7.0 or higher
- Composer (for dependency management)
- A Zoho Mail account (free or paid)

### Step 1: Clone or Download

[](#step-1-clone-or-download)

```
git clone https://github.com/mrsandipmandal/zoho-mail.git
cd zoho-mail
```

### Step 2: Install Dependencies

[](#step-2-install-dependencies)

```
composer install
```

This will install PHPMailer 7.0+ from Composer.

### Install via Composer (recommended)

[](#install-via-composer-recommended)

If you published the package to Packagist, install it into your project with Composer:

```
# stable release (preferred)
composer require open-php/zoho-mail
```

If Packagist shows only a dev branch (no stable tag), require the dev branch explicitly:

```
composer require open-php/zoho-mail:dev-master
# or use dev-main if your default branch is main
composer require open-php/zoho-mail:dev-main
```

If you get a "minimum-stability" error, either add an explicit dev constraint (as above) or allow dev stability in your project's `composer.json`:

```
{
    "minimum-stability": "dev",
    "prefer-stable": true
}
```

Recommendation: publish a stable tag (e.g., `v1.0.0`) in your package repository and update Packagist — then projects can require the package without dev constraints:

```
# in your package repo
# git tag -a v1.0.0 -m "v1.0.0"
# git push origin v1.0.0
```

### Step 3: Configure Credentials

[](#step-3-configure-credentials)

Provide credentials when you instantiate the `ZohoMail` class (do not edit package files).

You can pass credentials directly to the constructor or load them from environment variables. Example:

```
// prefer using Composer autoload and environment variables
require 'vendor/autoload.php';

use ZohoMail\ZohoMail;

$zoho = new ZohoMail(
    'your-email@zohomail.in',      // Your Zoho Mail address
    'your-app-password',           // Your Zoho password or App Password
    true                           // Debug mode (true for development, false for production)
);
```

Getting Your Zoho Credentials
-----------------------------

[](#getting-your-zoho-credentials)

### Standard Password

[](#standard-password)

If your Zoho account **does not have 2FA enabled**, use your regular account password.

### App Password (Recommended for 2FA)

[](#app-password-recommended-for-2fa)

If your Zoho account **has 2FA enabled**, you must create an App Password:

1. Log in to
2. Navigate to **Security** → **App Passwords**
3. Select "Mail" from the application dropdown
4. Click **Generate**
5. Copy the generated password and paste it into the `index.php` script

Usage
-----

[](#usage)

### Basic Email

[](#basic-email)

```
