africoders/laravel-mailer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

africoders/laravel-mailer

Composer 安装命令:

composer require africoders/laravel-mailer

包简介

Custom Laravel mailer that routes emails through an external API

README 文档

README

A custom Laravel mail transport driver that sends emails through a centralized HTTP API instead of SMTP. Useful for routing all email traffic through services like Mailgun, Mailpit, or internal email proxy APIs.

📡 Default endpoint: https://smtp.africoders.com/

🚀 Features

  • Custom mail transport using HTTP API
  • Compatible with Laravel 8, 10, and 11
  • Configurable API key and endpoint
  • Fully pluggable and override-ready
  • Designed for mail proxies and external SMTP wrappers

📦 Installation

composer require africoders/laravel-mailer

⚙️ Configuration

1. Publish the package config:

php artisan vendor:publish --tag=africoders-mailer-config

This publishes config/africoders-mailer.php:

return [
    'endpoint' => env('MAIL_CUSTOM_API_ENDPOINT', 'https://smtp.africoders.com/'),
    'api_key'  => env('MAIL_CUSTOM_API_KEY', 'changeme'),
];

2. Update your .env:

MAIL_MAILER=customapi
MAIL_CUSTOM_API_ENDPOINT=https://smtp.africoders.com/
MAIL_CUSTOM_API_KEY=12344343

📤 Sending Emails

Once configured, all emails sent via Laravel's Mail::to()->send() will be routed through your custom API transport.

Example JSON payload sent to the endpoint:

{
  "apiKey": "12344343",
  "from_name": "Africoders",
  "to": "user@example.com",
  "subject": "Hello",
  "html": "<h1>This is a test email</h1>"
}

🛠 API Expectations

Your API should accept a POST request with:

  • apiKey – required, must match configured key
  • to – recipient email
  • subject – subject of the email
  • html – email body (HTML)
  • from_address – optional (defaults to config)
  • from_name – optional (defaults to config)

🔐 Security

Make sure your API endpoint is protected using an apiKey or bearer token.

🤝 Contributing

Pull requests welcome! For major changes, please open an issue first to discuss what you would like to change.

📝 License

MIT © Africoders

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固