Tereta/Email Module

Overview

Email sending module. Supports SMTP and PHP's built-in mail() function.

Transports

  • SMTP — sending via SMTP server with TLS/SSL support
  • mail() — built-in PHP function (fallback)

Configuration

SMTP is configured in .config.php:

->set('smtp', Value::factory()->create()
    ->set('host', 'smtp.gmail.com')
    ->set('username', '[email protected]')
    ->set('password', 'password')
    ->set('from', '[email protected]'))

Usage

use Tereta\Email\Factories\Email as EmailFactory;

$email = EmailFactory::singleton()->create();
$email->send('[email protected]', 'Subject', '<p>Email body</p>');

Headers are automatically checked for injection attacks. Addresses are validated per RFC.

Author and License

Author: Tereta Alexander
Website: tereta.dev
License: Apache License 2.0. See LICENSE.

 www.████████╗███████╗██████╗ ███████╗████████╗ █████╗
     ╚══██╔══╝██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔══██╗
        ██║   █████╗  ██████╔╝█████╗     ██║   ███████║
        ██║   ██╔══╝  ██╔══██╗██╔══╝     ██║   ██╔══██║
        ██║   ███████╗██║  ██║███████╗   ██║   ██║  ██║
        ╚═╝   ╚══════╝╚═╝  ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝
                                                      .dev

Copyright (c) 2024-2026 Tereta Alexander