PHPackages                             yidas/socket-mailer - 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. yidas/socket-mailer

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

yidas/socket-mailer
===================

PHP SMTP Mailer library using fsockopen.

1.1.0(2y ago)4742MITPHP

Since Sep 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/yidas/php-socket-mailer)[ Packagist](https://packagist.org/packages/yidas/socket-mailer)[ Docs](https://github.com/yidas/php-socket-mailer)[ RSS](/packages/yidas-socket-mailer/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

PHP Socket Mailer
=================

[](#php-socket-mailer)

PHP SMTP Mailer library implemented by socket

[![Latest Stable Version](https://camo.githubusercontent.com/a66cd1036ff562fa009654fbc1e61882663489f9b1a7fd8300a34533342aeee2/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f736f636b65742d6d61696c65722f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/socket-mailer)[![Latest Unstable Version](https://camo.githubusercontent.com/1c96a42e3da97334fec2d0377d314a0cd0d1ff289a37667dcb63e37f015ad015/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f736f636b65742d6d61696c65722f762f756e737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/socket-mailer)[![License](https://camo.githubusercontent.com/b4f75a02f5c836338f98633a6cfa134fb2dc6c71f980ab414bf47d1cc44595e3/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f736f636b65742d6d61696c65722f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/socket-mailer)

---

DEMONSTRATION
-------------

[](#demonstration)

```
$mailer = new \yidas\socketMailer\Mailer([
    'host' => 'mail.your.com',
    'username' => 'service@your.com',
    'password' => 'passwd',
    ]);

$result = $mailer
    ->setSubject('Mail Title')
    ->setBody('Content Text')
    ->setTo(['name@your.com', 'peter@your.com' => 'Peter'])
    ->setFrom(['service@your.com' => 'Service Mailer'])
    ->setCc(['cc@your.com' => 'CC Receiver'])
    ->setBcc(['bcc@your.com'])
    ->send();
```

---

REQUIREMENTS
------------

[](#requirements)

This library requires the following:

- PHP 5.4.0+

---

INSTALLATION
------------

[](#installation)

Run Composer in your project:

```
composer require yidas/socket-mailer

```

Then you could call it after Composer is loaded depended on your PHP framework:

```
require __DIR__ . '/vendor/autoload.php';

use \yidas\socketMailer\Mailer;
```

---

CONFIGURATION
-------------

[](#configuration)

To use localhost MTA:

```
$mailer = new \yidas\socketMailer\Mailer()
```

To configure a external MTA server:

```
$mailer = new \yidas\socketMailer\Mailer([
    'host' => 'mail.your.com',
    'username' => 'service@your.com',
    'password' => 'passwd',
    'port' => 587,
    'encryption' => 'tls',
    ]);
```

### SSL Connection

[](#ssl-connection)

```
$mailer = new \yidas\socketMailer\Mailer([
    // ...
    'port' => 465,
    'encryption' => 'ssl',
    ]);
```

### Non-Auth Connection

[](#non-auth-connection)

If you want to connect to SMTP relay server with free auth in allowed networks:

```
$mailer = new \yidas\socketMailer\Mailer([
    'host' => 'mail.your.com',
    'port' => 25,
    ]);
```

---

USAGES
------

[](#usages)

### debugOn()

[](#debugon)

```
public self debugOn()
```

### setFrom()

[](#setfrom)

```
public self setFrom(string|array $form)
```

### setTo()

[](#setto)

```
public self setTo(array $recipients)
```

### setCc()

[](#setcc)

```
public self setCc(array $recipients)
```

### setBcc()

[](#setbcc)

```
public self setBcc(array $recipients)
```

### setBody()

[](#setbody)

```
public self setBody(string $text)
```

### setSubject()

[](#setsubject)

```
public self setSubject(string $title)
```

### addHeader()

[](#addheader)

```
public self addHeader($key, $value)
```

*Example:*

```
$mailer = $mailer->addHeader('Your-Header-Name', 'the header value');
```

### send()

[](#send)

```
public boolean send()
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

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

Total

2

Last Release

953d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b30d2b2c0b53aef65fad4af56cd3c7912d3db2b612890c706fe79448717f6aba?d=identicon)[yidas](/maintainers/yidas)

---

Top Contributors

[![yidas](https://avatars.githubusercontent.com/u/12604195?v=4)](https://github.com/yidas "yidas (9 commits)")

---

Tags

phpphp-socket-mailersmtpsmtp-relaysocketphpfsockopenSocketmailersmtp

### Embed Badge

![Health badge](/badges/yidas-socket-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/yidas-socket-mailer/health.svg)](https://phpackages.com/packages/yidas-socket-mailer)
```

###  Alternatives

[jason-munro/cypht

Lightweight Open Source webmail written in PHP and JavaScript

1.5k146.0k](/packages/jason-munro-cypht)[ahmedsamy/codeception-smtp-mail

Test emails in your Codeception acceptance tests

11172.7k1](/packages/ahmedsamy-codeception-smtp-mail)[hafael/azure-mailer-driver

Supercharge your Laravel or Symfony app with Microsoft Azure Communication Services (ACS)! Effortlessly add email, chat, voice, video, and telephony-over-IP for next-level communication. 🚀

14109.2k](/packages/hafael-azure-mailer-driver)[shieldon/messenger

Sending messages to the third-party services made easy for PHP.

2330.4k2](/packages/shieldon-messenger)[shuchkin/react-smtp-client

ReactPHP async SMTP Client

245.7k](/packages/shuchkin-react-smtp-client)

PHPackages © 2026

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