bonoweb/laravel-ews-driver

为Laravel添加Exchange Web Services邮件支持。

v2.0 2021-03-19 12:15 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:49:51 UTC


README

从以下地址分支而来 (https://github.com/adeboyed/laravel-ews-driver)

Packagist Version Packagist PHP Version Support

一个支持Exchange Web Services的邮件驱动,使用原始Laravel API。该库扩展了原始Laravel类,因此使用完全相同的方法。此软件包需要访问EWS主机。

此库使用php-ews库连接到Exchange Web Services主机。因此需要以下依赖项

  • Composer
  • PHP 5.4或更高版本
  • cURL支持NTLM(推荐7.30.0+)
  • Exchange 2007或更高版本

更多信息,请访问该仓库

安装(Laravel)

将软件包添加到composer.json并运行composer update。

"require": {
    "bonoweb/laravel-ews-driver": "~2"
},

在config/app.php中添加Exchange服务提供者:(Laravel 5.5+使用包自动发现,因此不需要手动添加ServiceProvider。)

'providers' => [
    Bonoweb\LaravelExchangeDriver\ExchangeAddedServiceProvider::class
];

安装(Lumen)

将软件包添加到composer.json并运行composer update。

"require": {
    "bonoweb/laravel-ews-driver": "~2"
},

或使用composer安装

$ composer require bonoweb/laravel-ews-driver

在bootstrap/app.php中添加exchange服务提供者

$app->configure('mail');
$app->configure('services');
$app->register(Bonoweb\LaravelExchangeDriver\ExchangeServiceProvider::class);

unset($app->availableBindings['mailer']);

创建邮件配置文件。config/mail.php

<?php
return [
    'driver' => env('MAIL_DRIVER', 'exchange'),
];

配置

.env

MAIL_DRIVER=exchange
MAIL_HOST=webmail.example.com
MAIL_USERNAME=examplemail
MAIL_PASSWORD=examplepassword
MAIL_MESSAGE_DISPOSITION_TYPE=SaveOnly|SendAndSaveCopy|SendOnly
MAIL_CA_FILE="/path/to/cacert.pem"
MAIL_CLIENT_VERSION="Exchange2010"

config/mail.php(在Lumen中使用时,需要创建配置目录和文件,更多信息

    'mailers' => [
        'exchange' => [
            'transport' => 'exchange',
            'host' => env('MAIL_HOST'),
            'username' => env('MAIL_USERNAME'),
            'password' => env('MAIL_PASSWORD'),
            'messageDispositionType' => env('MAIL_MESSAGE_DISPOSITION_TYPE') // Optional, default: SendAndSaveCopy
            'clientVersion' => env('MAIL_CLIENT_VERSION'), //Optional
            'caFile' => env('MAIL_CA_FILE'), // Optional, if you want to set a specific SSL CA 
        ],
    ],

有关消息处理类型的更多信息,请查看此处

##附件

如果您发送附件有问题,请尝试在.env中设置MAIL_CLIENT_VERSION="Exchange2010_SP2" 查看此处