spiralover/mailer-client 问题修复 & 功能扩展

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

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

spiralover/mailer-client

最新稳定版本:0.1.3

Composer 安装命令:

composer require spiralover/mailer-client

包简介

Webhook Mail Routing Client

README 文档

README

Mail Router PHP Client

Getting started

composer require spiralover/mailer-client

Usage

Application Management

<?php

use SpiralOver\Mailer\Client\Application;

require __DIR__ . '/vendor/autoload.php';

$client  = Application::client(authToken: '<authentication-token>');

// List
$applications = $client->list();

// Create
$created = $client->create(
    name: 'My Application 1',
    url: 'localhost:7788',
    webhook: 'localhost:7788/webhook',
    desc: 'Hello World',
);

// Update
$updated = $client->update(
    id: $created->application_id,
    name: 'My Application 1',
    url: 'localhost:7788',
    webhook: 'localhost:7788/webhook',
    desc: 'Hello World',
);

// Fetch Info
$viewed = $application->read('2eb91dc3-b8ad-4d41-a207-963cec055fac');

// Delete
$message = $application->delete($created->neuron_id);

Sending Emails

Sending mails to receivers

<?php

use GuzzleHttp\Exception\GuzzleException;
use SpiralOver\Mailer\Client\Dto\Mailbox;
use SpiralOver\Mailer\Client\Dto\MailData;
use SpiralOver\Mailer\Client\Exceptions\RequestFailureException;
use SpiralOver\Mailer\Client\Mailer;

require __DIR__ . '/vendor/autoload.php';

$client  = Mailer::client(authToken: '<authentication-token>');
$response = $client->send(
    appId: '2eb91dc3-b8ad-4d41-a207-963cec055fab',
    mails: [
        MailData::create(
            subject: 'Test 001',
            message: 'Hello World',
            from: Mailbox::create(
                name: 'SpiralOver',
                email: 'noreply@spiralover.com'
            ),
            receiver: [
                Mailbox::create(
                    name: 'Jane Doe',
                    email: 'jane.doe@spiralover.com'
                )
            ]
        )
    ]
);

You can also specify cc, bcc & reply to

MailData::create(
    [...],
    cc: [
        Mailbox::create(
            name: 'Jane',
            email: 'jane@spiralover.com'
        )
    ],
    bcc: [
        Mailbox::create(
            name: 'Shaheed',
            email: 'shaheed@spiralover.com'
        )
    ],
    reply_to: [
        Mailbox::create(
            name: 'Tom Tucker',
            email: 'tom.tucker@spiralover.com'
        )
    ]
);

Client Options

<?php

use SpiralOver\Mailer\Client\Application;

require __DIR__ . '/vendor/autoload.php';

$client  = Application::client(
    authToken: '<authentication-token>',
    server: Application::SERVER_SPIRALOVER,
    apiVersion: 'v1'
);

Enjoy 😎

统计信息

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

GitHub 信息

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

其他信息

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