PHPackages                             3dots/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. 3dots/mail

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

3dots/mail
==========

Nette Mail: Sending E-mails

v2.3.4(10y ago)068BSD-3-ClausePHPPHP &gt;=5.3.1

Since May 11Pushed 10y ago1 watchersCompare

[ Source](https://github.com/3dotsru/mail)[ Packagist](https://packagist.org/packages/3dots/mail)[ Docs](https://nette.org)[ RSS](/packages/3dots-mail/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (14)Used By (0)

Nette Mail: Sending E-mails
===========================

[](#nette-mail-sending-e-mails)

[![Downloads this Month](https://camo.githubusercontent.com/347d788daa691a3bb47ab06aeb1bfc561610af91ef72340450e6612205fcada3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6e657474652f6d61696c2e737667)](https://packagist.org/packages/nette/mail)[![Build Status](https://camo.githubusercontent.com/a07a69140336fd27ac4b86e807c9c3d3590d35f22721ef52a70a2b84e60c4f35/68747470733a2f2f7472617669732d63692e6f72672f6e657474652f6d61696c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nette/mail)[![Latest Stable Version](https://camo.githubusercontent.com/a3c47c5312d5d1835b0c312ef71cd99b62371b4043c12c020d75c26299be365d/68747470733a2f2f706f7365722e707567782e6f72672f6e657474652f6d61696c2f762f737461626c65)](https://github.com/nette/mail/releases)[![License](https://camo.githubusercontent.com/fa7d5fcf2c84b580327af52da95dd751703af65f079dc3c5a0081beac0789718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4e65772532304253442d626c75652e737667)](https://github.com/nette/mail/blob/master/license.md)

Almost every web application needs to send e-mails, whether newsletters or order confirmations. That's why Nette Framework provides necessary tools.

Example of creating an e-mail using `Nette\Mail\Message` class:

```
use Nette\Mail\Message;

$mail = new Message;
$mail->setFrom('John ')
	->addTo('peter@example.com')
	->addTo('jack@example.com')
	->setSubject('Order Confirmation')
	->setBody("Hello, Your order has been accepted.");
```

All parameters must be encoded in UTF-8.

And sending:

```
use Nette\Mail\SendmailMailer;

$mailer = new SendmailMailer;
$mailer->send($mail);
```

In addition to specifying recipient with `addTo()`, it's possible to specify recipient of copy with `addCc()` and recipient of blind copy: `addBcc()`. In all these methods, including `setFrom()`, we can specifiy addressee in three ways:

```
$mail->setFrom('john.doe@example.com');
$mail->setFrom('john.doe@example.com', 'John Doe');
$mail->setFrom('John Doe ');
```

HTML content can be defined using `setHtmlBody()` method:

```
$mail->setHTMLBody('Sample HTML ');
```

Embedded images can be inserted using `$mail->addEmbeddedFile('background.gif')`, but it is not necessary. Why? Because Nette Framework finds and inserts all files referenced in the HTML code automatically. This behavior can be supressed by adding `FALSE` as a second parameter of the `setHtmlBody()` method.

If a HTML e-mail has no plain-text alternative, it will be automatically generated. And if it has no subject set, it will be taken from the `` element.

Of course, it's possible to add attachments to the e-mail:

```
$mail->addAttachment('example.zip');
```

Can e-mail sending be even easier?

Custom mailer
-------------

[](#custom-mailer)

Default mailer uses PHP function `mail`. If you need to send mail through a SMTP server, you can use `SmtpMailer`.

```
$mailer = new Nette\Mail\SmtpMailer(array(
        'host' => 'smtp.gmail.com',
        'username' => 'john@gmail.com',
        'password' => '*****',
        'secure' => 'ssl',
));
$mailer->send($mail);
```

You can also create your own mailer - it's a class implementing Nette\\Mail\\IMailer interface.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 81.8% 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 ~47 days

Recently: every ~15 days

Total

13

Last Release

3816d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d382c69b963dcbf5f97da4d52eb44fcd65ba6db6812cd7c6f21079bda0372191?d=identicon)[3dotsru](/maintainers/3dotsru)

---

Top Contributors

[![dg](https://avatars.githubusercontent.com/u/194960?v=4)](https://github.com/dg "dg (157 commits)")[![kravco](https://avatars.githubusercontent.com/u/115938?v=4)](https://github.com/kravco "kravco (7 commits)")[![vrana](https://avatars.githubusercontent.com/u/117453?v=4)](https://github.com/vrana "vrana (4 commits)")[![JanTvrdik](https://avatars.githubusercontent.com/u/175109?v=4)](https://github.com/JanTvrdik "JanTvrdik (3 commits)")[![3dotsru](https://avatars.githubusercontent.com/u/13533108?v=4)](https://github.com/3dotsru "3dotsru (2 commits)")[![dundee](https://avatars.githubusercontent.com/u/27106?v=4)](https://github.com/dundee "dundee (2 commits)")[![enumag](https://avatars.githubusercontent.com/u/539462?v=4)](https://github.com/enumag "enumag (2 commits)")[![jakubboucek](https://avatars.githubusercontent.com/u/1657322?v=4)](https://github.com/jakubboucek "jakubboucek (2 commits)")[![xificurk](https://avatars.githubusercontent.com/u/117465?v=4)](https://github.com/xificurk "xificurk (2 commits)")[![jkrcma](https://avatars.githubusercontent.com/u/68111?v=4)](https://github.com/jkrcma "jkrcma (1 commits)")[![juzna](https://avatars.githubusercontent.com/u/227416?v=4)](https://github.com/juzna "juzna (1 commits)")[![hrach](https://avatars.githubusercontent.com/u/284263?v=4)](https://github.com/hrach "hrach (1 commits)")[![masicek](https://avatars.githubusercontent.com/u/1160736?v=4)](https://github.com/masicek "masicek (1 commits)")[![pavolbiely](https://avatars.githubusercontent.com/u/115791?v=4)](https://github.com/pavolbiely "pavolbiely (1 commits)")[![petasittek](https://avatars.githubusercontent.com/u/777564?v=4)](https://github.com/petasittek "petasittek (1 commits)")[![petrkle](https://avatars.githubusercontent.com/u/545514?v=4)](https://github.com/petrkle "petrkle (1 commits)")[![robbertkl](https://avatars.githubusercontent.com/u/5704510?v=4)](https://github.com/robbertkl "robbertkl (1 commits)")[![storkdork](https://avatars.githubusercontent.com/u/399349?v=4)](https://github.com/storkdork "storkdork (1 commits)")[![fprochazka](https://avatars.githubusercontent.com/u/158625?v=4)](https://github.com/fprochazka "fprochazka (1 commits)")[![janedbal](https://avatars.githubusercontent.com/u/1993453?v=4)](https://github.com/janedbal "janedbal (1 commits)")

### Embed Badge

![Health badge](/badges/3dots-mail/health.svg)

```
[![Health](https://phpackages.com/badges/3dots-mail/health.svg)](https://phpackages.com/packages/3dots-mail)
```

###  Alternatives

[nette/mail

📧 Nette Mail: A handy library for creating and sending emails in PHP.

5389.8M246](/packages/nette-mail)[netflie/laravel-notification-whatsapp

Laravel notification driver for WhatsApp

176173.9k](/packages/netflie-laravel-notification-whatsapp)

PHPackages © 2026

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