PHPackages                             pyataks/sendmail - 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. pyataks/sendmail

ActiveLibrary

pyataks/sendmail
================

Send messages for the different ways.

1.0.8(9y ago)021BSDPHP

Since Apr 7Pushed 8y agoCompare

[ Source](https://github.com/pyataks/sendmail)[ Packagist](https://packagist.org/packages/pyataks/sendmail)[ Docs](https://github.com/pyataks/sendmail)[ RSS](/packages/pyataks-sendmail/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (12)Used By (0)

Send email
----------

[](#send-email)

Install
-------

[](#install)

```
composer require pyataks/sendmail
```

### Examples

[](#examples)

#### SMTP configuration

[](#smtp-configuration)

```
$smtpConfig = [
    'host' => 'ssl://smtp.gmail.com',
    'port' => 465,
    'username' => 'username@gmail.com',
    'password' => ''
];
```

#### Mandrill configuration

[](#mandrill-configuration)

```
$mandrillKey = 'mandrill API-key';
```

#### Send message with attach through the mail()

[](#send-message-with-attach-through-the-mail)

```
$mailer = new Mailer(new MailTransport());
try {
	$message = (new Message())
            ->to('emailto@example.com', 'Jon')
            ->from('emailfrom@example.com', 'Jon Mailer')
            ->subject('Test subject. Send mail php')
            ->body('Test content. Send mail php', 'text/html')
            ->attach('full_filename', ['name' => 'main-logo.png', 'mime_type' => 'image\png']);
} catch (\InvalidArgumentException $e) {
	echo $e, PHP_EOL;
}

try {
	echo $mailer->send($message);
} catch (\pyatakss\sendmail\PSMailException $e) {
	echo $e, PHP_EOL;
}
```

#### Create different transports

[](#create-different-transports)

```
$mailTransport = new MailTransport();
$smtpTransport = new SMTPTransport($smtpConfig);
$mandrillTransport = new MandrillTransport($mandrillKey);
```

#### Create transport for the mail()

[](#create-transport-for-the-mail)

```
$mailer = new Mailer($mailTransport);
```

#### Prepare messages

[](#prepare-messages)

```
$messageCyrillicText = (new Message())
    ->to('emailto1@example.com', 'Рома')
    ->to('emailto2@example.com', 'Маша')
    ->to('emailto3@example.com', 'Кирилл')
    ->from('emailfrom@example.com', 'Джон Сильвер')
    ->subject('Тема на кирилице. Send mail php')
    ->body('Текст письма. Писмо отправелно без attach.  Send mail php', 'text/html');

$messageSwift = (new SwiftMessageAdapter(new \Swift_Message()))
    ->to('emailto1@example.com', 'Рома')
    ->to('emailto2@example.com', 'Маша')
    ->to('emailto3@example.com', 'Кирилл')
    ->from('emailfrom@example.com', 'Джон Сильвер')
    ->subject('Subject English swift . Send mail php')
    ->body('Text of the letter. Letter sent WITH attach.  Send mail php', 'text/html')
    ->attach($listFiles[0])
    ->attach($listFiles[1]);
```

#### Sending through mail

[](#sending-through-mail)

```
echo $mailer->send($messageCyrillicText);
```

#### Change transport to SMTP, change subject of prepared mail, and, finally, send

[](#change-transport-to-smtp-change-subject-of-prepared-mail-and-finally-send)

```
$mailer->setTransport($smtpTransport);

$messageEnglish->subject('Subject English. Send smtp php');
echo $mailer->send($messageEnglish);
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

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

Recently: every ~36 days

Total

9

Last Release

3545d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0aed603b95c583b0f7fe29528d8f38daf497171c9eca761a9b9ce3f43c90ea52?d=identicon)[pyatakss](/maintainers/pyatakss)

---

Top Contributors

[![inkOf](https://avatars.githubusercontent.com/u/13074828?v=4)](https://github.com/inkOf "inkOf (1 commits)")

### Embed Badge

![Health badge](/badges/pyataks-sendmail/health.svg)

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

###  Alternatives

[rock-symphony/rock-symphony

Fork of symfony 1.4 with dic, form enhancements, latest swiftmailer and better performance

19164.1k3](/packages/rock-symphony-rock-symphony)[oleksandr-torosh/yona-cms

Yona CMS - open source content management system (CMS). Written in Phalcon PHP Framework (v 1.3.x). Has a convenient modular structure. Has simple configuration and architecture. Can be easily modified for any task with any loads.

3652.1k](/packages/oleksandr-torosh-yona-cms)[webiny/framework

Webiny Framework

1031.4k3](/packages/webiny-framework)

PHPackages © 2026

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