src/Biz/Mail/CloudMail.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Mail;
use Biz\CloudPlatform\CloudAPIFactory;
use Biz\Common\CommonException;
class CloudMail extends Mail
{
/**
* @sourceFrom: 发送来源(默认不传,crm插件需传值)
* @sendedSn: 发送批次号(默认不传,crm传入发送的批次号)
*
* @return bool
*/
public function doSend()
{
$cloudConfig = $this->setting('cloud_email_crm', array());
if (isset($cloudConfig['status']) && $cloudConfig['status'] == 'enable') {
$options = $this->options;
$template = $this->parseTemplate($options['template']);
$format = isset($options['format']) && $options['format'] == 'html' ? 'html' : 'text';
$this->checkType($options);
$params = array(
'to' => $this->to,
'title' => $template['title'],
'body' => $template['body'],
'format' => $format,
'template' => 'email_default',
'sourceFrom' => empty($options['sourceFrom']) ? '' : $options['sourceFrom'],
'type' => empty($options['type']) ? 'transaction' : $options['type'],
);
if (!empty($options['sendedSn'])) {
$params['sendedSn'] = $options['sendedSn'];
}
$api = CloudAPIFactory::create('root');
$result = $api->post('/emails', $params);
return empty($result['sendedSn']) ? false : true;
}
return false;
}
private function checkType($options)
{
$allowedTypes = array(
'market',
'transaction',
);
if (empty($options['type']) || in_array($options['type'], $allowedTypes)) {
return;
}
throw CommonException::ERROR_PARAMETER();
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。