g4/mailer

mailer php library with multiple mail providers (smtp, amazon_ses)

2.1.0 2024-02-27 10:16 UTC

README

mailer - php library

Install

Via Composer

composer require g4/mailer

Usage

<?php 

// Config data
$options = [
    'delivery' => "smtp",
    'adapter'  => "smtp",
    'params'   => [
        'host'              => "smtp.example.com",
        'port'              => "587",
        'connection_class'  => "plain",
        'connection_config' => [
            'ssl'      => "tls",
            'username' => "smtp_username",
            'password' => "smtp_password"
        ]
    ]
];

// Create message
$message = new \G4\Mailer\Message(
    'receiver@example.com',
    'sender@example.com',
    'Email subject',
    'This is a <strong>html</strong> email part',
    'This is a text email part'
);

// Create mailer instance
$mailer = \G4\Mailer\Mailer::factory($options);

// send message
$mailer->send($message);

?>

Development

Install dependencies

$ make install

Run tests

$ make test

License

(The MIT License) see LICENSE file for details...