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

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

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

adrashyawarrior/laravel-multi-mailer

最新稳定版本:v1.0.0

Composer 安装命令:

composer require adrashyawarrior/laravel-multi-mailer

包简介

This package allows laravel project to integrate multiple mail providers on priority bases.

README 文档

README

AdrashyaWarrior Laravel Multi-Mailer is a package built on top of mailgun, sendinblue & sendgrid email providers.

STEP(1): Installation

Go to your project's root directory and run

composer require adrashyawarrior/laravel-multi-mailer

STEP(2): Update .env

Add the following environment varables

# priority
MAILERS=sendgrid,mailgun,sendinblue
# Mailgun
MAILGUN_API_KEY=''
MAILGUN_HOSTNAME=''
MAILGUN_DOMAIN=''
# Sendinblue
SENDINBLUE_API_KEY=''
# Sendgrid
SENDGRID_API_KEY=''

STEP(3): Usage

Inside your controller

<?php

namespace App\Http\Controllers;

use Adrashyawarrior\LaravelMultiMailer\LaravelMultiMailer;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Log;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function sendmail()
    {
        try {
            $mailer = new LaravelMultiMailer();
            $mailer->from('shiva@gmail.com', 'Shaiva Sh');
            $mailer->to(['krishna@gmail.com']);
            $mailer->cc(['radha@gmail.com']);
            $mailer->bcc(['sudama@gmail.com']);
            $mailer->subject('Testing New Package');
            $mailer->html('<!DOCTYPE html>
            <html lang="en">
            <head>
                <meta charset="UTF-8">
                <meta http-equiv="X-UA-Compatible" content="IE=edge">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <title>Document</title>
            </head>
            <body>
                <h1>This is a testing mail.</h1>
            </body>
            </html>');
            $response = $mailer->send();
            return response()->json($response);
        } catch (\Exception $e) {
            Log::info($e->getMessage());
            return response('Error');
        }
    }
}

Congrats! Done.

You are all set to send emails.

Contributing

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

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固