2017 © Pedro Peláez
 

library smtp

SMTP client

image

gaswelder/smtp

SMTP client

  • Friday, September 1, 2017
  • by gaswelder
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SMTP client

This client speaks SMTP protocol to deliver messages. This makes it possible to:, (*1)

  • send mail from where normal mail functions are not working;
  • send the message to many recipients in one call.

Basic usage example

use gaswelder\smtp\Client;
use gaswelder\smtp\Mail;

$mail = new Mail();
$mail->subject = "Hey there";
$mail->body = ";)";

$returnPath = "bob@example.net";
$destinationPath = "alice@example.net";

$smtp = new Client();
$smtp->connect("smtp.example.net");
$smtp->login("bob", "****");
$smtp->send($mail, $returnPath, $destinationPath);

Mail list example

use gaswelder\smtp\Client;
use gaswelder\smtp\Mail;

$mail = new Mail();
$mail->to = "To whom it might concern";
$mail->subject = "Viagra!";
$mail->body = ";)";

$recipients = [
    "phb@fortune.com",
    "bob@example.net",
    "bill@example.net"
];
$smtp = new Client();
$smtp->connect("mail.net");
$smtp->login("mailer", "****");
$smtp->send($mail, "mailer@mail.net", $recipients);

SSL

The client always uses SSL (STARTTLS) before logging in. It's possible to tweak the SSL parameters by defining the ssl option to a map of SSL context options according to http://php.net/manual/en/context.ssl.php. For example, to allow self-signed certificates:, (*2)

$client = new Client([
    'ssl' => [
        'allow_self_signed' => true
    ]
]);

Logging

To get log messages (which include client and server messages sent over the connection) define the logger option to be a callable accepting the log line:, (*3)

$client = new Client([
    'logger' => function($line) {
        fwrite(STDERR, $line."\n");
    }
]);

Installation

composer require gaswelder/smtp

The Versions

01/09 2017

dev-master

9999999-dev

SMTP client

  Sources   Download

MIT

01/09 2017

0.9.0

0.9.0.0

SMTP client

  Sources   Download

MIT