fgiardina/mailer 问题修复 & 功能扩展

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

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

fgiardina/mailer

Composer 安装命令:

composer require fgiardina/mailer

包简介

Laravel email sender

README 文档

README

Software License Travis Total Downloads

Installation

composer require fgiardina/mailer

If you are using Laravel 5.5+, there is no need to manually register the service provider. However, if you are using an earlier version of Laravel, register the MailerServiceProvider in your app configuration file:

'providers' => [
    // Other service providers...

    Fgiardina\Mailer\MailerServiceProvider::class,
],

Publish

php artisan vendor:publish --provider="Fgiardina\Mailer\MailerServiceProvider"

Configure email settings

.env file:

  MAIL_DRIVER=smtp
  MAIL_HOST=smtp.mailtrap.io
  MAIL_PORT=2525
  MAIL_USERNAME=xxxxxxxxxxxx
  MAIL_PASSWORD=xxxxxxxxxxxx
  MAIL_ENCRYPTION=null
  MAIL_FROM_ADDRESS=example@mail.com
  MAIL_FROM_NAME="example"

  MAILER_VIEWS_FOLDER=vendor.mailer #change custom path
  MAILER_SEND_ROUTE="/mailer/sendemail" #change custom route
  MAILER_TEST_ROUTE="/mailer/testemail" #change custom route
  MAILER_TEST_MAIL_FORM_ENABLE=true #false: disabled public access test from {MAILER_TEST_ROUTE}

Usage

  • Web form
http://YOUR-DOMAIN/mailer/testemail
  • Terminal or Postman client
curl -X POST \
  http://YOUR-DOMAIN/mailer/sendemail \
  -H 'Content-Type: application/json' \
  -d '{
    "to_name": "John Doe",
    "to_email": "john@doe.com",
    "to_bcc_email": "john2@doe.com",
    "subject": "Email title",
    "header": "Header Info",
    "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
    "footer": "Footer Info",
    "template": "format"
}'
  • URL default: http://YOUR-DOMAIN/mailer/sendemail
  • URL custom: http://YOUR-DOMAIN/{MAILER_SEND_ROUTE} replace by value in .env file

Required: to_email, subject, body, template

Templates

HTML template without format

  "template": "basic"

HTML formatted template

  "template": "format"

Custom templates:

Path: MAILER_VIEWS_FOLDER

  "template": "mycustomtemplate"

mycustomtemplate.blade.php

// ...HTML
<body>

    @isset($data->header)
        <header>{{ $data->header }}</header>  
    @endisset

    <div>{{ $data->body }}</div>

    @isset($data->footer)
        <footer>{{ $data->footer }}</footer>  
    @endisset

</body>  
// ...HTML
Attention!
Never use {!! !!} in template. This can cause security problems

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固