PHPackages                             shuchkin/simplemail - 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. shuchkin/simplemail

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

shuchkin/simplemail
===================

PHP mail/SMTP composer and mailer class

0.7.13(2y ago)172665MITPHPPHP &gt;=5.3.0

Since Feb 3Pushed 2y ago1 watchersCompare

[ Source](https://github.com/shuchkin/simplemail)[ Packagist](https://packagist.org/packages/shuchkin/simplemail)[ Docs](https://github.com/shuchkin/simplemail)[ RSS](/packages/shuchkin-simplemail/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (3)Used By (0)

SimpleMail class 0.7.13
=======================

[](#simplemail-class-0713)

A simple mail composer, phpmailer alternative, SMTP client.
UTF-8 html messages and attachements supported.

Basic Usage
-----------

[](#basic-usage)

```
$mail = new Shuchkin\SimpleMail();
$mail->setFrom('example@example.com')
	->setTo('sergey.shuchkin@gmail.com')
	->setSubject('Test SimpleMail')
	->setText('Hi, Sergey!')
	->send();
```

Install
-------

[](#install)

The recommended way to install this library is [through Composer](https://getcomposer.org). [New to Composer?](https://getcomposer.org/doc/00-intro.md)

This will install the latest supported version:

```
$ composer require shuchkin/simplemail
```

or download class [here](https://github.com/shuchkin/simplemail/blob/master/src/SimpleMail.php)

Fabric
------

[](#fabric)

```
// setup mail
$mail = new Shuchkin\SimpleMail();
$mail->setFrom('example@example.com', 'Example');

// fabric method to( $toEmail )
$mail->to('sergey.shuchkin@gmail.com')
	->setSubject('Account activation')
	->setHTML('Your account has activated!', true)
	->send();

// fabric method compose( $toEmail, $subject, $text )
$mail->compose('admin@example.com', 'New Account', 'https://example.com/useradmin/123')->send();
```

SMTP
----

[](#smtp)

```
$mail = new Shuchkin\SimpleMail('smtp', [
	'host' => 'ssl://smtp.yandex.ru',
    'port'     => 465,
    'username' => 'test@yandex.ru',
    'password' => 'test'
]);

$mail->setFrom('test@yandex.ru)
	->setTo('sergey.shuchkin@gmail.com')
	->setSubject('Test SMTP')
	->setText('Yandex SMTP secured server')
	->send();
```

Attachments &amp; reply
-----------------------

[](#attachments--reply)

```
$mail = new Shuchkin\SimpleMail();
$mail->setFrom('example@example.com')
	->setTo('sergey.shuchkin@gmail.com')
	->setSubject('Test attachments')
	->setHTML('See attached price list. Logo')
	->attach( __DIR__.'/doc/PriceList.pdf')
	->attach( __DIR__.'/images/logo400x300.jpg', 'logo.jpg')
	->setReply('manager@example.com')
	->send();
```

Priority &amp; custom headers
-----------------------------

[](#priority--custom-headers)

```
$mail = new Shuchkin\SimpleMail();
$mail->setFrom('example@example.com')
	->setTo('sergey.shuchkin@gmail.com')
	->setSubject('WARNING!')
	->setText('SERVER DOWN!')
	->setPriority('urgent')
	->setCustomHeaders(['Cc' => 'admin@exmple.com'])
	->send();
```

Custom transport
----------------

[](#custom-transport)

```
$mail = new Shuchkin\SimpleMail( function( $mail, $encoded ) {
	print_r( $encoded );
});
$mail->setFrom('example@example.com')
	->setTo('sergey.shuchkin@gmail.com')
	->setSubject('WARNING!')
	->setText('SERVER DOWN!')
	->send();

/*
Array
(
    [from] => example@example.com
    [to] => sergey.shuchkin@gmail.com
    [subject] => =?UTF-8?B?V0FSTklORyE=?=
    [message] => SERVER DOWN!
    [headers] => To: sergey.shuchkin@gmail.com
Subject: =?UTF-8?B?V0FSTklORyE=?=
X-Mailer: PHP/7.2.14
MIME-Version: 1.0
From: example@example.com
Reply-To: example@example.com
Date: Mon, 18 Feb 2019 13:17:28 +0000
Content-Type: text/plain; charset="UTF-8"
)
*/
```

Export &amp; import
-------------------

[](#export--import)

```
SimpleMail::toArray() - export to array
SimpleMail::fromArray( $data ) - import from assoc array (fabric)
SimpleMail::toJSON() - export to JSON
SimpleMail::fromJSON( $json ) - import from json (fabric)

```

History
-------

[](#history)

0.7.13 (2023-01-15) all properties is public now 0.7.12 (2022-02-04) PHP/5.3 support
0.7.11 (2019-02-18) Initial release

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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 ~710 days

Total

2

Last Release

851d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/551f9169d9efadfa85ff5ff512eab17e9219ba10e42636d9a31f1021a1027395?d=identicon)[shuchkin](/maintainers/shuchkin)

---

Top Contributors

[![shuchkin](https://avatars.githubusercontent.com/u/315872?v=4)](https://github.com/shuchkin "shuchkin (10 commits)")

---

Tags

phpmailsmtp

### Embed Badge

![Health badge](/badges/shuchkin-simplemail/health.svg)

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

###  Alternatives

[txthinking/mailer

A very lightweight PHP SMTP mail sender

10098.9k3](/packages/txthinking-mailer)[shuchkin/react-smtp-client

ReactPHP async SMTP Client

245.7k](/packages/shuchkin-react-smtp-client)[henrique-borba/php-sieve-manager

A modern (started in 2022) PHP library for the ManageSieve protocol (RFC5804) to create/edit Sieve scripts (RFC5228). Used by Cypht Webmail.

23125.7k2](/packages/henrique-borba-php-sieve-manager)

PHPackages © 2026

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