📧 Lightweight PHP email library with SMTP, queues, and analytics
ApeliMailers is a PHP email library providing SMTP support, email queuing capabilities, and analytics. It's designed for developers who need a lightweight, flexible solution for handling email operations.
- SMTP Support: Send emails via SMTP with TLS/SSL encryption
 - Multiple Transport Options: Support for SMTP, Sendmail, and custom transports
 - Email Analytics: Track email performance metrics
 - Security-Focused: Built with security best practices
 - Configurable: Adaptable to various email service providers
 - Extensible Architecture: Create custom transport adapters
 
composer require apeli/apelimailers<?php
require __DIR__ . '/vendor/autoload.php';
use ApeliMailers\Core\Mailer;
use ApeliMailers\Transport\SmtpTransport;
// Configure transport
$transport = new SmtpTransport(
    'smtp.example.com',
    587,
    'username',
    'password',
    'tls'
);
// Initialize mailer
$mailer = new Mailer($transport);
// Create and send message
$message = $mailer->createMessage()
    ->from('[email protected]', 'Sender Name')
    ->to('[email protected]', 'Recipient Name')
    ->subject('Hello from ApeliMailers')
    ->html('<h1>Welcome!</h1><p>This is an email sent with ApeliMailers.</p>');
$result = $mailer->send($message);$transport = new SmtpTransport(
    'smtp.example.com',  // Host
    587,                 // Port
    'username',          // Username
    'password',          // Password
    'tls',               // Encryption: 'tls', 'ssl', or null
    false                // Debug mode (optional)
);use ApeliMailers\Transport\SendmailTransport;
$transport = new SendmailTransport('/usr/sbin/sendmail -bs');Create a .env file in your project root:
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
Load configuration in your code:
<?php
require __DIR__ . '/vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
$transport = new SmtpTransport(
    $_ENV['MAIL_HOST'],
    $_ENV['MAIL_PORT'],
    $_ENV['MAIL_USERNAME'],
    $_ENV['MAIL_PASSWORD'],
    $_ENV['MAIL_ENCRYPTION']
);$message->addAttachment('/path/to/file.pdf', 'document.pdf');$message->to('[email protected]', 'Recipient Name')
        ->cc('[email protected]', 'CC Recipient')
        ->bcc('[email protected]', 'BCC Recipient')
        ->replyTo('[email protected]', 'Reply Handler');ApeliMailers is open-source software licensed under the MIT license.