lokielse/aliyun-open-api-dm

The Direct Mail SDK for Aliyun OpenAPI

v1.0.1 2017-11-19 09:04 UTC

This package is not auto-updated.

Last update: 2022-05-14 14:17:14 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

The DM SDK for Aliyun OpenAPI

Install

Via Composer

$ composer require lokielse/aliyun-open-api-dm

Usage

/**
 * 访问信息
 */
$config = [
	'AccessKeyId'=>'<your access_key_id>',
	'AccessKeySecret'=>'<your access_key_secret>',
];

/**
 * 配置网关
 */
$endpoint = new Endpoint('cn-hangzhou', EndpointConfig::getRegionIds(), EndpointConfig::getProductDomains());
EndpointProvider::setEndpoints([ $endpoint ]);

/**
 * 授权资料
 */
$profile = DefaultProfile::getProfile('cn-hangzhou', $config['AccessKeyId'], $config['AccessKeySecret']);


/**
 * 请求对象
 */
$request = new SingleSendMailRequest();
$request->setAccountName('notice@push.example.com');
$request->setFromAlias('Pusher');
$request->setAddressType(1);
$request->setReplyToAddress('true');
$request->setToAddress('to@example.com');
$request->setSubject('Demo Subject');
$request->setHtmlBody('Hello World!');

$client  = new DefaultAcsClient($profile);
$response = $client->getAcsResponse($request);

var_dump($response);

官方文档

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email lokielse@gmail.com instead of using the issue tracker.

Credits

License

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