定制 jornatf/msgraph-mailer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jornatf/msgraph-mailer

最新稳定版本:v2.0.1

Composer 安装命令:

composer require jornatf/msgraph-mailer

包简介

A Laravel Package to send emails with Microsoft Graph API.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel Package to send emails with Microsoft Graph API.

If you like this package you can Buy me a Coffee ☕️

Installation

Via composer:

composer require jornatf/msgraph-mailer

Prerequisites:

Add your Microsoft Graph credentials in the .env file:

MSGRAPH_CLIENT_ID=your_client_id
MSGRAPH_SECRET_ID=your_secret_id
MSGRAPH_TENANT_ID=your_tenant_id

Usage

Example:

This example shows you how to use the basic methods required to send an email.

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;

class PostController extends Controller
{
    public function sendMail()
    {
        try {
            $msgraph = MsGraphMailer::mail('your@mailbox.com')
                ->to(['John Doe:john.doe@example.com', 'other@example.com', $otherRecipients])
                ->subject('A simple email')
                ->body('<h1>Send a simple email to one recipient.</h1>')
                ->send();
        } catch (\Exception $e) {
            return $e->getMessage();
        }

        return "Email sended!";
    }
}

Available methods:

<?php

// First, instantiate response with your Msgraph mailbox (required):
$msgraph = MsGraphMailer::mail(string $mailbox);

// Add a main recipient(s), a subject and a content (required):
$msgraph->to(array $toRecipient);
$msgraph->subject(string $subject);
$msgraph->content(string $contentHTML);

// You can add Cc and/or bcc with the same way (optionally):
$msgraph->cc(array $ccRecipient);
$msgraph->bcc(array $bccRecipient);

// Optionally, you can add one or many attachments:
$msgraph->addAttachment(array $attachment = [
    'name' => $filename,
    'contentType' => $contentType,
    'content' => $contentBytes
]);
// and repeat if you have many attachments.

// Last, send your mail:
$msgraph->send();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Feel free to contribute to this project to improve with new features or fix bugs 👍

Credits

License

The MIT License (MIT).

Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固