pepipost/pepipost-lib 问题修复 & 功能扩展

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

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

pepipost/pepipost-lib

Composer 安装命令:

composer require pepipost/pepipost-lib

包简介

Convenient way to send emails from laravel through pepipost api

README 文档

README

pepipostlogo

Packagist Packagist Open Source Helpers Twitter Follow

Laravel SDK interface for Pepipost

This package maps the Pepipost SDK to the laravel application

To use this package required your Pepipost Api Key. Please make it Here.

We are trying to make our libraries Community Driven- which means we need your help in building the right things in proper order we would request you to help us by sharing comments, creating new issues or pull requests.

We welcome any sort of contribution to this library.

The latest 1.0.0 version of this library provides is fully compatible with the latest Pepipost v5.1 API.

For any update of this library check Releases.

Table of Content

Installation

Prerequisites

PHP >= 7.x

Composer v2.3.10

Laravel >= 8.x

A free account on Pepipost. If you don't have a one, click here to signup.

Usage

Configuring laravel project

Step 1 - Create New Laravel project

$ composer create-project laravel/laravel example-app

Step 2 - install with composer

$ composer require pepipost/pepipost-lib

Step 3 - Configurations

  1. Add API key to the .env file

    PEPIPOST_API_KEY='<API_TOKEN_KEY>'
    
  2. Export the config file to the laravel app

    $ php artisan vendor:publish --provider="Pepipost\PepipostLib\PepipostServiceProvider" --tag="config"

Step 4- Laravel Steps to create controller and route

  1. Create Controller

    php artisan make:controller sendMail
  2. Update controller with email structure

        <?php
        namespace App\Http\Controllers;
        use Illuminate\Http\Request;
        use Pepipost\PepipostLib\Models;
        use Pepipost\PepipostLib\PepipostLib as Mailer;
        
        class Mailsend extends Controller
        {
            public static function send(Request $request){
        
                $body = new Models\Send;
                $body->from = new Models\From;
        
                $body->from->email = 'John@domain.com';
                $body->from->name = 'John';
                $body->subject = 'Pepipost Test Mail from laravel';
        
                $body->content = array();
                $body->content[0] = new Models\Content;
                $body->content[0]->type = Models\TypeEnum::HTML;
                $body->content[0]->value = '<html><body>Hello, Welcome to Pepipost Family àèìòù.<br>My name is [% name %].<br>my love is sending [% love %]</body> <br></html>';
    
                $body->attachments[0] = new Models\Attachments;
                $body->attachments[0]->attach(storage_path('Discussions.pdf'));
                #optional
                $body->attachments[0]->name = 'discussionwithteam.pdf';
        
                $body->personalizations = array();
                $body->personalizations[0] = new Models\Personalizations;
                $body->personalizations[0]->attributes = ["name" => "Pepi", "love" => "email"];
                $body->personalizations[0]->tokenTo = '<identity-string>';
        
                $body->personalizations[0]->to = array();
                $body->personalizations[0]->to[0] = new Models\EmailStruct;
                $body->personalizations[0]->to[0]->name = 'Doe';
                $body->personalizations[0]->to[0]->email = 'doe@domain.com';
        
                $body->personalizations[0]->cc = array();
                $body->personalizations[0]->cc[0] = new Models\EmailStruct;
                $body->personalizations[0]->cc[0]->name = 'elina';
                $body->personalizations[0]->cc[0]->email = 'elina@domain.com';
        
                $mailer = new Mailer();
                try {
                  var_dump($mailer->sendMail($body));
                } catch (Pepipost\PepipostLib\APIException $e) {
                  return $e->getMessage;
                }
            }
        }
  3. Create Route in routes/web.php

    Route::get('/sendmail', function () {
      return App::call('App\Http\Controllers\Mailsend@send');
    });

Step 5 - Testing

Host your laravel project and enter url- http://your_url.com/sendmail in browser

This will send email and display Email sent successfully on browser.

Additional Usage

For more advanced usage you can check the advance usage doc for getting help with more complicated scenarios.

Announcements

v1.0.0 has been released! Please see the release notes for details.

All updates to this library are documented in our releases. For any queries, feel free to reach out us at dx@pepipost.com

Roadmap

If you are interested in the future direction of this project, please take a look at our open issues and pull requests. We would love to hear your feedback.

About

pepipost-laravel library is guided and supported by the Pepipost Developer Experience Team . This pepipost library is maintained and funded by Pepipost Ltd. The names and logos for pepipost gem are trademarks of Pepipost Ltd.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固