ankitfromindia/parallel-smtp
Composer 安装命令:
composer require ankitfromindia/parallel-smtp
包简介
High-performance parallel SMTP client for Laravel with connection pooling and pipelining - up to 10x faster bulk email sending
关键字:
README 文档
README
High-performance parallel SMTP client for Laravel that dramatically improves bulk email sending performance through concurrent connections, connection pooling, and SMTP pipelining.
🚀 Performance Features
- Parallel Processing: Up to 10 concurrent SMTP connections
- Connection Pooling: Reuse connections for up to 100 messages each
- SMTP Pipelining: Reduced latency through command batching
- Auto Resource Management: Automatic connection cleanup and recycling
- Enterprise Ready: Optimized for high-volume email campaigns
📋 Requirements
- PHP 8.3+
- Laravel 10.0+, 11.0+, or 12.0+
- SMTP server that supports multiple connections
📦 Installation
Install via Composer:
composer require ankitfromindia/parallel-smtp
The package will auto-register with Laravel's service container.
⚙️ Configuration
Publish the configuration file:
php artisan vendor:publish --tag=parallel-smtp-config
Add SMTP settings to your .env file:
# SMTP Server Configuration PARALLEL_SMTP_HOST=smtp.example.com PARALLEL_SMTP_PORT=587 PARALLEL_SMTP_USERNAME=your_username PARALLEL_SMTP_PASSWORD=your_password PARALLEL_SMTP_ENCRYPTION=tls # Performance Settings PARALLEL_SMTP_MAX_CONNECTIONS=10 PARALLEL_SMTP_MESSAGES_PER_CONNECTION=100
🔧 Usage
Basic Usage
use AnkitFromIndia\ParallelSmtp\Http\ParallelSmtpClient; class BulkEmailService { public function sendCampaign(array $recipients) { $client = app(ParallelSmtpClient::class); $messages = []; foreach ($recipients as $recipient) { $messages[] = [ 'from' => 'campaign@example.com', 'to' => $recipient['email'], 'subject' => 'Welcome to Our Newsletter', 'body' => view('emails.welcome', $recipient)->render(), 'content_type' => 'text/html' ]; } $results = $client->sendBulk($messages); return $this->processResults($results); } private function processResults(array $results): array { $stats = ['sent' => 0, 'failed' => 0, 'errors' => []]; foreach ($results as $index => $result) { if ($result['success']) { $stats['sent']++; } else { $stats['failed']++; $stats['errors'][] = "Message {$index}: {$result['error']}"; } } return $stats; } }
Advanced Usage with CC/BCC
$messages = [ [ 'from' => 'sender@example.com', 'to' => 'primary@example.com', 'cc' => ['cc1@example.com', 'cc2@example.com'], 'bcc' => ['bcc@example.com'], 'subject' => 'Important Update', 'body' => '<h1>Update Notification</h1><p>Content here...</p>', 'content_type' => 'text/html' ] ]; $client = app(ParallelSmtpClient::class); $results = $client->sendBulk($messages);
📊 Performance Comparison
| Method | 1000 Emails | 10000 Emails |
|---|---|---|
| Sequential | ~15 minutes | ~2.5 hours |
| Parallel SMTP | ~2 minutes | ~20 minutes |
| Improvement | 7.5x faster | 7.5x faster |
🔧 Configuration Options
| Option | Default | Description |
|---|---|---|
max_connections |
10 | Maximum concurrent SMTP connections |
messages_per_connection |
100 | Messages per connection before reset |
smtp.host |
- | SMTP server hostname |
smtp.port |
587 | SMTP server port |
smtp.encryption |
tls | Encryption method (tls/ssl) |
🛡️ Error Handling
$results = $client->sendBulk($messages); foreach ($results as $index => $result) { if ($result['success']) { echo "✅ Email {$index}: Sent successfully\n"; } else { echo "❌ Email {$index}: {$result['error']}\n"; } }
📝 License
The MIT License (MIT). Please see License File for more information.
ankitfromindia/parallel-smtp 适用场景与选型建议
ankitfromindia/parallel-smtp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 132 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「smtp」 「laravel」 「parallel」 「concurrent」 「enterprise」 「email marketing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ankitfromindia/parallel-smtp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ankitfromindia/parallel-smtp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ankitfromindia/parallel-smtp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Sequential way to run Symfony Processes in parallel
Generic PHP Threads library using only pure PHP
Asynchronous parallel Twitter client built on the Amp concurrency framework
The Message Submission Agent Diagnostics tool (msadiag) facilitates testing the compatibility of third party message submission agents.
Execute PHP code in parallel with single or persistent task worker.
PHPMailer helper class for sending emails using SMTP
统计信息
- 总下载量: 132
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-16