The DM SDK for Aliyun OpenAPI
基于Lokielse[https://github.com/lokielse/php-aliyun-open-api-core]
Via Composer
$ composer require xjdata/aliyun-open-api-dm
/**
* 访问信息
*/
$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 \Aliyun\Dm\Request\SingleSendMailRequest();
$request->setAccountName("[email protected]");
$request->setFromAlias("某某");
$request->setAddressType(1);
$request->setTagName("youtagname");
$request->setReplyToAddress("true");
$request->setToAddress("[email protected]");
$request->setSubject("邮件主题");
$request->setHtmlBody("邮件正文");
$response = $client->getAcsResponse($request);
var_dump($response);