PHPackages                             mouf/utils.mailer.smtp-mail-service - 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. mouf/utils.mailer.smtp-mail-service

ActiveMouf-library[Mail &amp; Notifications](/categories/mail)

mouf/utils.mailer.smtp-mail-service
===================================

This package contains a mailer that uses a SMTP server to send mail. The package is a wrapper around the Zend\_Mail class of the Zend framework.

v2.0.0(12y ago)019.2k1MITPHPPHP &gt;=5.3.0

Since Mar 6Pushed 8y ago12 watchersCompare

[ Source](https://github.com/thecodingmachine/utils.mailer.smtp-mail-service)[ Packagist](https://packagist.org/packages/mouf/utils.mailer.smtp-mail-service)[ Docs](https://github.com/thecodingmachine/utils.mailer.smtp-mail-service)[ RSS](/packages/mouf-utilsmailersmtp-mail-service/feed)WikiDiscussions 2.0 Synced 3w ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (1)

The SmtpMailService
===================

[](#the-smtpmailservice)

The `SmtpMailService` is used to send mails using a SMTP mail server.

The `SmtpMailService` is designed to be simple to use. Behind the scene, the `SmtpMailService`is using the more complex (and more powerful) ZendFramework 2 mail service.

Install
-------

[](#install)

This package is part of the [Mouf PHP framework](http://mouf-php.com). As such, it comes with a nice graphical installer.

[![Install screen](doc/images/smtp_install.png)](doc/images/smtp_install.png)

You can configure the settings to connect to your SMTP server.

There is one compulsory parameter: **host**, which is the address of the server.

By default, on Linux systems, it is likely you will use the local mail server (host=127.0.0.1). You will have a "sendmail" or "postfix" server installed on your machine. If you are performing your developments on a Windows machine, it is quite likely that you will not have an SMTP server on your machine. You will therefore have to use a remote server. To access the remote server, you will certainly have to use login/passwords, etc...

When this package is installed, it will create a default "smtpMailService" and put in this instance all the parameters you have provided.

Note: nothing prevents you from creating several instances of the SmtpMailService class with different parameters (in the rare case you have an application that needs to connect to several SMTP servers).

After installation, you will see that a number of constants have been added to your `config.php` file. When deploying on other servers, you can of course change those constants to adapt to the settings of the server.

Tip: using your gmail account to send mails
-------------------------------------------

[](#tip-using-your-gmail-account-to-send-mails)

In a development environment, it can be useful to use you gmail account. Here are the settings:

- host =&gt; 'smtp.gmail.com'
- ssl =&gt; 'tls'
- port =&gt; 587
- auth =&gt; 'login'
- username =&gt; *Your gmail mail address*
- password =&gt; *Your password*

Example use
-----------

[](#example-use)

Below is a sample code you can use to send a mail.

```
use Mouf\Utils\Mailer\Mail;
use Mouf\Utils\Mailer\SmtpMailService;

// First, let's create the mail object
$mail = new Mail();
$mail->setTitle("My mail");
$mail->setBodyText("This is my mail!");
$mail->setBodyHtml("This is my &lt;b&gt;mail&lt;/b&gt;!");
$mail->setFrom(new MailAddress("my@server.com", "Server"));
$mail->addToRecipient(new MailAddress("david@email.com", "David"));

// Let's get the instance of the service
$mailService = Mouf::getSmtpMailService();

// Finally, we send the mail
$mailService->send($mail);
```

To learn more about how to send mails, refer to the [Introduction to Mouf's mail architecture](http://mouf-php.com/packages/mouf/utils.mailer.mail-interface/README.md).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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

4496d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (6 commits)")[![nguyenk](https://avatars.githubusercontent.com/u/2227554?v=4)](https://github.com/nguyenk "nguyenk (1 commits)")

---

Tags

mailservicemailermoufsmtp

### Embed Badge

![Health badge](/badges/mouf-utilsmailersmtp-mail-service/health.svg)

```
[![Health](https://phpackages.com/badges/mouf-utilsmailersmtp-mail-service/health.svg)](https://phpackages.com/packages/mouf-utilsmailersmtp-mail-service)
```

###  Alternatives

[nette/mail

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

49210.1M268](/packages/nette-mail)[mlocati/spf-lib

Parse, build and validate SPF (Sender Policy Framework) DNS records

67920.0k4](/packages/mlocati-spf-lib)[pear/net_smtp

An implementation of the SMTP protocol

263.1M21](/packages/pear-net-smtp)[voku/bounce-mail-handler

Bounce Mail Handler

49240.3k2](/packages/voku-bounce-mail-handler)[thefox/smtpd

SMTP server (library) written in pure PHP.

1262.5k1](/packages/thefox-smtpd)

PHPackages © 2026

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