yunusasuroglu/bulk-mailler 问题修复 & 功能扩展

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

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

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

  1. Fork this project.
  2. Create a new feature branch (feature/feature-adi).
  3. Commit your changes (git commit -m 'New feature added').
  4. Push the branch to master (git push origin feature/feature-adi).
  5. 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 yunusasuroglu/bulk-mailler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-12