PHPackages                             trejjam/emailing - 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. trejjam/emailing

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

trejjam/emailing
================

Send email over rabbitMQ

v0.5(11y ago)024MITPHPPHP &gt;=5.3.1

Since Dec 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/trejjam/Emailing)[ Packagist](https://packagist.org/packages/trejjam/emailing)[ RSS](/packages/trejjam-emailing/feed)WikiDiscussions master Synced 1mo ago

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

Emailing
========

[](#emailing)

Library for

- managing emails
- their groups
- send email to group(s)
- save email to IMAP

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

[](#installation)

The best way to install Trejjam/Emailing is using [Composer](http://getcomposer.org/):

```
$ composer require trejjam/emailing
```

Configuration RabbitMq
----------------------

[](#configuration-rabbitmq)

Look how to configure [Kdyby/RabbitMq](https://github.com/Kdyby/RabbitMq/blob/master/docs/en/index.md)This extension need only 'rabbitmq.connection'

```
extensions:
	rabbitmq: Kdyby\RabbitMq\DI\RabbitMqExtension

rabbitmq:
	connection:
		default:
			host: localhost
			port: 5672
			user: 'guest'
			password: 'guest'
			vhost: '/'
```

Configuration
-------------

[](#configuration)

.neon

```
extensions:
	emailing: Trejjam\DI\EmailingExtension

emailing:
	tables   :
		emails      :
			table : send__emails
			id    : id
			email : email
		groups      :
			table    : send__groups
			id       : id
			parentId : parent_id
			name     : name
			type     :
				name    : type
				options : [public, private]
		group_email :
			table      : send__group_email
			id         : id
			groupId    : group_id
			emailId    : email_id
			newsletter :
				name    : newsletter
				options : [enable, disable]
		senders     :
			table      : send__sender
			id         : id
			email      : email
			configName : config_name
	connect  :
		default :
			smtp          : FALSE #TRUE - use SmtpMailer NULL - disable connection FALSE - use SendmailMailer
			host          : NULL
			smtp_port     : NULL
			username      : NULL
			password      : NULL
			secure        : ssl

			imap          : FALSE
			imap_host     : TRUE #TRUE -> use host
			imap_port     : 993
			imap_param    : /imap/ssl/validate-cert #Flags from http:#php.net/manual/en/function.imap-open.php
			imap_username : TRUE #TRUE -> use username
			imap_password : TRUE #TRUE -> use password
		other:
			...
	rabbitmq :
		mailer    :
			templateDir    : '/presenters/templates/'
			defaultTemplate: 'emails/default.latte'
		imap      :
			sendFolder : 'Sent.From web'
		producers :
			mailer :
				name       : NULL #NULL -> use mailer
				connection : default
				exchange   : NULL #NULL -> use mailer
			imap   :
				name       : NULL #NULL -> use imap
				connection : default
				exchange   : NULL
		consumers :
			mailer :
				connection : default
				exchange   : NULL
				queue      : NULL
			imap   :
				connection : default
				exchange   : NULL
				queue      : NULL
	cache    :
		use     : TRUE
		name    : emailing
		timeout : 60 minutes
```

Config
------

[](#config)

The best way for configuration is using [Kdyby/Console](https://github.com/kdyby/console)

```
$ composer require kdyby/console
```

Read how to install [Kdyby/Console](https://github.com/Kdyby/Console/blob/master/docs/en/index.md)

```
php index.php
```

After successful installation display:

```
Available commands:
Emailing
	Emailing:imap       Basic IMAP task
	Emailing:groups     Edit groups
	Emailing:install    Install default tables
	help                Displays help for a command
	list                Lists commands

```

Config database
---------------

[](#config-database)

Create default tables:

```
php index.php Emailing:install
```

Config imap
-----------

[](#config-imap)

List folders:

```
php index.php Emailing:imap [connectionName=default] -l
```

Add folder:

```
php index.php Emailing:imap [connectionName=default] -c folderName [-l]
```

Config groups
-------------

[](#config-groups)

Add group:

```
php index.php Emailing:groups groupName [parentName] -c [-t type] [-l]
```

Move group:

```
php index.php Emailing:groups groupName [parentName] -m [-l]
```

Edit group:

```
php index.php Emailing:groups groupName -t type [-l]
```

Delete group:

```
php index.php Emailing:groups groupName -r [-l]
```

List all groups:

```
php index.php Emailing:groups -l
```

Config senders
--------------

[](#config-senders)

Add sender:

```
php index.php Emailing:senders senderEmail [connection=default] -c [-l]
```

Change connection:

```
php index.php Emailing:senders senderEmail [connection=default] [-l]
```

Delete sender:

```
php index.php Emailing:senders senderEmail -r [-l]
```

List all senders:

```
php index.php Emailing:senders -l
```

Usage
-----

[](#usage)

Presenter/Model:

```
	/**
	* @var \Trejjam\Emailing\RabbitMq\Mailer @inject
	*/
	public $rabbitMailer;
	/**
	 * @var \Trejjam\Emailing\Emails @inject
	 */
	public $emails;
	/**
	 * @var \Trejjam\Emailing\Groups @inject
	 */
	public $groups;
	/**
	 * @var \Trejjam\Emailing\Senders @inject
	 */
	public $senders;

	function renderDefault() {
		$this->senders->addSender("email@from.ltd");
		$this->senders->addSender("email2@from.ltd", "other");

		$message=$this->rabbitMailer->createEmail();
		$message->setSender("email@from.ltd"); //set from and connection
		$message->setImapSave(TRUE);

		$message->setTo("email@to.ltd");
		$this->rabbitMailer->send($message);
		//send email generated by defaultTemplate, send using default connection, save email to IMAP

		$message->setSender("email2@from.ltd");
		$message->setTemplate("newsletter.latte");
		$message->setImapFolder("Sent.newsletter");
		$message->setImapConnection("default");
		$message->setUnsubscribeEmail("unsubscribe-1@from.ltd");
		$message->setTo("email2@to.ltd");
		$this->rabbitMailer->send($message);
		//send email generated by newsletter.latte, send using 'other' connection, save email to IMAP using 'default'

		$email = $this->emails->addEmail("email@to.ltd");
		$email2 = $this->emails->addEmail("email2@to.ltd");
		$all=$this->groups->addGroup("all");
		$group = $this->groups->addGroup("newsletter", "all");

		$this->emails->addEmailToGroup($email, $group);
		$this->emails->addEmailToGroup($email2, $all);

		foreach ($all->getEmailsRecursive() as $v) {
			dump($v->getEmail()); //email2@to.ltd, email@to.ltd
		}
		foreach ($all->getEmails() as $v) {
			dump($v->getEmail()); //email2@to.ltd
		}
		foreach ($group->getEmails() as $v) {
			dump($v->getEmail()); //email@to.ltd
		}

		dump($this->groups->getGroup("all")->containEmail($email)); //FALSE
		dump($this->groups->getGroup("newsletter")->containEmail($email)); //TRUE
		$this->emails->removeEmail("email@to.ltd", TRUE);
		$this->emails->removeEmail("email2@to.ltd", TRUE);
	}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

Total

2

Last Release

4158d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/497b0b5c3df7d9a3a4349ccd81b47db5b6027fc7d49510a04265dd966d01f846?d=identicon)[trejjam](/maintainers/trejjam)

---

Top Contributors

[![trejjam](https://avatars.githubusercontent.com/u/3594540?v=4)](https://github.com/trejjam "trejjam (6 commits)")

---

Tags

netteemailrabbitmq

### Embed Badge

![Health badge](/badges/trejjam-emailing/health.svg)

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

###  Alternatives

[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[sendgrid/sendgrid

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

1.5k47.5M164](/packages/sendgrid-sendgrid)[pelago/emogrifier

Converts CSS styles into inline style attributes in your HTML code

94944.1M110](/packages/pelago-emogrifier)[zbateson/mail-mime-parser

MIME email message parser

54149.2M79](/packages/zbateson-mail-mime-parser)[soundasleep/html2text

A PHP script to convert HTML into a plain text format

48519.5M75](/packages/soundasleep-html2text)[opcodesio/mail-parser

Parse emails without the mailparse extension

226.8M8](/packages/opcodesio-mail-parser)

PHPackages © 2026

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