Skip to content

switon-php/mail

Repository files navigation

Switon Mail Package

Mail CI PHP 8.3+

Switon's mailer for composing outbound messages, delivering them through pooled SMTP connections, and surfacing delivery events.

Highlights

  • Message composition: MailerInterface::compose() builds a ready-to-send message object.
  • Delivery flow: recipients are validated before the message is sent.
  • SMTP transport: repeated delivery can reuse a pooled connection.
  • Delivery visibility: mail send, success, and failure states can be observed.
  • Transport-ready messages: composed messages can be sent directly.

Installation

composer require switon/mail

Quick Start

use Switon\Core\Attribute\Autowired;
use Switon\Mail\Address;
use Switon\Mail\MailerInterface;
use Switon\Mail\Message;

class NotifyService
{
    #[Autowired] protected MailerInterface $mailer;

    public function ping(string $to): void
    {
        $msg = Message::compose()
            ->from(new Address('app@example.com'))
            ->to(new Address($to))
            ->subject('Ping')
            ->text('Hello.');

        $this->mailer->send($msg->get());
    }
}

Docs: https://docs.switon.dev/latest/mail

License

MIT.

About

Outbound mail with fluent messages, SMTP serialization, and pooled transport for Switon Framework

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages