yunusasuroglu/bulk-mailler
Composer 安装命令:
composer require yunusasuroglu/bulk-mailler
包简介
Bulk email sending package for Laravel
README 文档
README
Bulk Emails is a package developed for Laravel that makes sending bulk emails easy. With this package, you can send emails to multiple recipients quickly and securely. The package is customizable and easily integrated with a simple structure.
Version: 1.0
This first version offers basic bulk email sending functionality.
Package Installation
Run the following Composer command to include your package in the project:
composer require yunusasuroglu/bulk-emailler
View Create
Create a blade for Email Template, you can also do this manually:
mkdir -p resources/views/emails touch resources/views/emails/bulk-email.blade.php
Controller Create
This part is given as an example, you can shape it according to your own project:
php artisan make:controller BulkEmailController
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use YunusAsuroglu\BulkEmailler\Facades\BulkEmailer; class BulkEmailController extends Controller { public function BulkMail() { return view('email-form'); } public function sendBulkMail(Request $request) { $testEmails = "example@example.com, test@test.com"; $testSubject = "Test Mailler"; $testMessage = "content"; $testItem = "item"; $testItem2 = "item2"; // You can add as much as you want here, it's up to you. $emails = collect(explode(',', $testEmails))->map(fn($email) => trim($email))->filter(fn($email) => filter_var($email, FILTER_VALIDATE_EMAIL))->unique()->values()->all(); if (empty($emails)) { return response()->json(['error' => 'Invalid email format.'], 400); } $subject = $testSubject; $view = 'emails.bulkmailer'; $data = [ 'message' => $testMessage, 'testItem' => $testItem, 'subject' => $testSubject, 'testItem2' => $testItem2, ]; try { BulkEmailer::sendBulkMail($emails, $subject, $view, $data); return response()->json(['message' => 'Emails sent successfully!']); } catch (\Exception $e) { return response()->json(['error' => $e->getMessage()], 500); // Error Message View } } }
web.php
Add Routes :
Route::get('/bulk-email', [BulkEmailController::class, 'BulkMail'])->name('bulk.email'); Route::post('/send-bulk-email', [BulkEmailController::class, 'sendBulkMail'])->name('send.bulk.email');
Example Form View
This place is completely yours, you can customize it as you wish:
<form method="POST" action="{{ route('send.bulk.email') }}"> @csrf <div class="form-group"> <label class="form-label text-primary">Emails</label> <input type="text" name="emails" class="form-control"> </div> <div class="form-group"> <label class="form-label text-primary">Mail Subject</label> <input type="text" name="subject" class="form-control"> </div> <div class="form-group mt-3"> <label class="form-label text-primary" for="exampleFormControlTextarea1">Mail Content</label> <textarea name="content" class="form-control" rows="5"></textarea> </div> <button id="submitButton" type="submit" class="btn mt-3 btn-primary">Send</button> </form>
Example Mail View
This place is completely yours, you can customize it as you wish:
<!DOCTYPE html> <html lang="tr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{{ $subject ?? 'Mail Subject' }}</title> </head> <body> <div class="email-container"> <p>{{ $data['message'] ?? 'Mail Subject' }}</p> </div> </body> </html>
Requirements
- PHP 8.0 or above
- Composer
Contribute
- Fork this project.
- Create a new feature branch (
feature/feature-adi). - Commit your changes (
git commit -m 'New feature added'). - Push the branch to master (
git push origin feature/feature-adi). - Open a Pull Request.
Licence
This project is licensed under the MIT License.
yunusasuroglu/bulk-mailler 适用场景与选型建议
yunusasuroglu/bulk-mailler 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 12 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 yunusasuroglu/bulk-mailler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yunusasuroglu/bulk-mailler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-12