PHPackages                             actweb/mail-auth - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. actweb/mail-auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

actweb/mail-auth
================

Mail server authentication class, allows authenticating users against POP/IMAP/SMTP with or without SSL

0.5(7y ago)0231GPL-3.0PHP

Since Sep 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/marl-scot/mailAuth)[ Packagist](https://packagist.org/packages/actweb/mail-auth)[ Docs](https://actweb.co.uk/php/actweb/mailauth)[ RSS](/packages/actweb-mail-auth/feed)WikiDiscussions master Synced 4d ago

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

mailAuth
========

[](#mailauth)

Overview
--------

[](#overview)

PHP Class to authenticate a user against a mail server.

Specification
-------------

[](#specification)

Allow setting of auth type : POP3, POP3S, IMAP, IMAPS, SMTP, SMTPS.

Take a username and a password and then attempt a login to the specified mail server.

If login is successful, then return true, else return false.

SMTP authentication function adapted from :

Usage
-----

[](#usage)

Configurable settingsDefault ValueDescriptionmailServerUrlNONEMailserver URLserverPortNONEMailserver Port number, normally automatically set after by setting the serverType, but can be overridden if requiredserverTypeNONEService to use for authentication POP3/POP3S/IMAP/IMAPS/SMTP/SMTPSserverTypesArray of TypesBuilt in list of valid services for authenticationerrorsArray of ErrorsList of all error codes, there description and some help text on what the issue may beusernameNONESet to the username to be used for authenticationpasswordNONESet to the password to be used for authenticationpasswordTypeplainCurrently on 'plain' is used, possible future enhancement to allow form based password encryptionpasswordTypesList of supported passwordTypes, currently only 'plain' is supportedloggerNull Logger\\Monolog\\Logger if passed to constructor, this is used for all loggingsslChecktrueIf true, then perform SSL verification on the connection. **NOTE** If using POP or IMAP, this should be set to 'false' as some bug causes PHP imap\_open to still check SSL when using non-ssl connectionauthenticatedEMPTYStatus of the authentication, set to True after user sucsesfully authenticates or False otherwisetimeOut30Time out for SMTP connections, best to set this to a low value, as the authentication script will wait till this timeout if there is an issue connecting to the servernewLine\\r\\nEnd Of Line terminator to use in SMTP comunicationssmtpLocalHostNONELocal hostname for SMTP authentication, not currently used, will most likely be removed in a future revision.##### Setup Logging, not required but good for debug

[](#setup-logging-not-required-but-good-for-debug)

```
$logger=new Logger('auth');
$logger->pushHandler(new StreamHandler(__DIR__.'/auth.log', LOGGER::DEBUG));
$logger->info('Auth Script Starting');

```

After authenticate() has been called, you can check the result of the authentication with :

```
$result=$auth->authenticated;

```

#### SMTP Authentication

[](#smtp-authentication)

```
$auth=new MailAuth($logger);
$auth->setMailServerUrl('MySMTPServerHostName');
$auth->setServerType('SMTP');
$auth->setSmtpLocalHost('MyLocalHostName');
$auth->setTimeOut(10);
$auth->setSslCheck(false);
$auth->setUsername('MyUserName');
$auth->setPassword('MyPassword');
$result=$auth->authenticate();

```

#### SMTPS Authentication

[](#smtps-authentication)

```
$auth=new MailAuth($logger);
$auth->setMailServerUrl('MySMTPServerHostName');
$auth->setServerType('SMTPS');
$auth->setSmtpLocalHost('MyLocalHostName');
$auth->setTimeOut(10);
$auth->setSslCheck(true);
$auth->setUsername('MyUserName');
$auth->setPassword('MyPassword');
$result=$auth->authenticate();

```

#### POP3 Authentication

[](#pop3-authentication)

```
$auth=new MailAuth($logger);
$auth->setMailServerUrl('MyPOPServerHostName');
$auth->setServerType('POP3');
$auth->setSslCheck(false);
$auth->setUsername('MyUserName');
$auth->setPassword('MyPassword');
$result=$auth->authenticate();

```

#### POP3S Authentication

[](#pop3s-authentication)

```
$auth=new MailAuth($logger);
$auth->setMailServerUrl('MyPOPServerHostName');
$auth->setServerType('POP3S');
$auth->setSslCheck(true);
$auth->setUsername('MyUserName');
$auth->setPassword('MyPassword');
$result=$auth->authenticate();

```

#### IMAP Authentication

[](#imap-authentication)

```
$auth=new MailAuth($logger);
$auth->setMailServerUrl('MyIMAPServerHostName');
$auth->setServerType('IMAP');
$auth->setSslCheck(false);
$auth->setUsername('MyUserName');
$auth->setPassword('MyPassword');
$result=$auth->authenticate();

```

#### IMAPS Authentication

[](#imaps-authentication)

```
$auth=new MailAuth($logger);
$auth->setMailServerUrl('MyIMAPServerHostName');
$auth->setServerType('IMAPS');
$auth->setSslCheck(true);
$auth->setUsername('MyUserName');
$auth->setPassword('MyPassword');
$result=$auth->authenticate();

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

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

Unknown

Total

1

Last Release

2801d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28bb0abb941ac14fdb5c3f0bd2ffa65d4e4998bcc7b06a9cf2f86bc318fadf51?d=identicon)[marl\_scot](/maintainers/marl_scot)

---

Top Contributors

[![marl-scot](https://avatars.githubusercontent.com/u/5879564?v=4)](https://github.com/marl-scot "marl-scot (7 commits)")

---

Tags

authsmtpimapauthenticatepop3pop3simapssmtps

### Embed Badge

![Health badge](/badges/actweb-mail-auth/health.svg)

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

###  Alternatives

[webklex/laravel-imap

Laravel IMAP client

7164.2M13](/packages/webklex-laravel-imap)[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[aura/auth

Provides a unified interface to authenticate a user with local or remote authentication systems.

138238.7k12](/packages/aura-auth)[xety/cake3-cookieauth

A simple Cake3 plugin to authenticate users with Cookies.

1954.7k2](/packages/xety-cake3-cookieauth)

PHPackages © 2026

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