thienvu18/symfony-postal-mailer

Symfony Postal Mailer Bridge using Postal's PHP client

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

Type:symfony-mailer-bridge

pkg:composer/thienvu18/symfony-postal-mailer

v1.0.4 2025-10-19 04:28 UTC

This package is auto-updated.

Last update: 2025-12-19 04:50:16 UTC


README

Provides Postal Email integration for Symfony Mailer.

Symfony Postal Mailer Bridge

License: GPL v3

A Symfony Mailer Bridge for Postal using the official postalserver/postal-php client. This package is inspired by symfony/postal-mailer, but leverages the official Postal PHP client instead of implementing the API manually.

Features

  • Seamless integration with Symfony Mailer
  • Uses the official Postal PHP client for reliability and future compatibility
  • Simple configuration and usage

Installation

composer require thienvu18/symfony-postal-mailer

Usage

Configure your Symfony Mailer to use the Postal transport. Example configuration:

# config/packages/mailer.yaml
framework:
  mailer:
    dsn: 'postal+api://<api-key>@<host>:<port>'

Replace <api-key>, <host>, and <port> with your Postal server details.

Usage with Laravel

You can use this package as a custom Symfony transport in Laravel by registering the Postal transport in the boot method of one of your service providers (e.g., App\Providers\AppServiceProvider):

use Illuminate\Support\Facades\Mail;
use Kyle\PostalMailer\Transport\PostalTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;

public function boot(): void
{
  Mail::extend('postal', function () {
      return (new PostalTransportFactory)->create(
          new Dsn(
              'postal+api',
              config('services.postal.base_url'),
              null,
              config('services.postal.key')
          )
      );
  });
}

Next, add a new mailer to your config/mail.php:

'mailers' => [
  'postal' => [
    'transport' => 'postal',
  ],
  // ...existing mailers...
],

Then, add an entry for your Postal API credentials to your application's config/services.php configuration file:

'services' => [
  'postal' => [
      'base_url' => env('POSTAL_BASE_URL'),
      'key' => env('POSTAL_API_KEY'),
  ],
  // ...existing services
]

Also, set your API key in your .env file:

POSTAL_BASE_URL=your-base-url
POSTAL_API_KEY=your-postal-api-key

Finally, set your default mailer to postal in your .env file:

MAIL_MAILER=postal

Credits

Thank you to both projects for their excellent work and open source contributions!

License

This project is licensed under the GPL-3.0-or-later.