定制 thienvu18/symfony-postal-mailer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thienvu18/symfony-postal-mailer

最新稳定版本:v1.0.4

Composer 安装命令:

composer require thienvu18/symfony-postal-mailer

包简介

Symfony Postal Mailer Bridge using Postal's PHP client

README 文档

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.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2025-09-09