ReactPHP async SMTP Client to send a simple email
Branch: master
Clone or download
Latest commit 79cee4f Feb 3, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples 0.1.1 Feb 2, 2019
src 0.1.1 Feb 2, 2019
.gitattributes 0.1.1 Feb 2, 2019
.gitignore 0.1.1 Feb 2, 2019
LICENSE 0.1.1 Feb 2, 2019
README.md fix readme examples Feb 3, 2019
composer.json composer.json Feb 3, 2019

README.md

react-smtp-client

ReactPHP async SMTP client to send a simple email.

Basic Usage

$loop = \React\EventLoop\Factory::create();

$smtp = new \Shuchkin\ReactSMTP\Client( $loop ); // localhost:25

$smtp->send('info@example.org', 'sergey.shuchkin@gmail.com', 'Test ReactPHP mailer', 'Hello, Sergey!')->then(
	function() {
		echo 'Message sent'.PHP_EOL;
	},
	function ( \Exception $ex ) {
		echo 'SMTP error '.$ex->getCode().' '.$ex->getMessage().PHP_EOL;
	}
);

$loop->run();

Using Google SMTP server

$loop = \React\EventLoop\Factory::create();

$smtp = new \Shuchkin\ReactSMTP\Client( $loop, 'tls://smtp.google.com:465', 'username@gmail.com','password' );

$smtp->send('username@gmail.com', 'sergey.shuchkin@gmail.com', 'Test ReactPHP mailer', 'Hello, Sergey!')->then(
	function() {
		echo 'Message sent via Google SMTP'.PHP_EOL;
	},
	function ( \Exception $ex ) {
		echo 'SMTP error '.$ex->getCode().' '.$ex->getMessage().PHP_EOL;
	}
);

$loop->run();

Google limit for personal SMTP 99 messages per 24 hours.

Install

The recommended way to install this library is through Composer. New to Composer?

This will install the latest supported version:

$ composer require shuchkin/react-smtp-client