今天在做MailBee系列产品的时候,想起了2014年去面试的时候被一个面试官问的很难堪的场面。
一般小型的系统我推荐用自建的smtp邮件推送,日推1000封还是没有问题的;如果是小型网站需要更多的推送量,那么可以考虑用阿里云的推送接口。
/**
* 阿里云云通信发送短息 2017
* @param string $mobile 接收手机号
* @param string $tplCode 短信模板ID
* @param array $tplParam 短信内容
* @return array
*/
function sendMsg($mobile, $tplCode, $tplParam)
{
require_once '../extend/aliyunsms/vendor/autoload.php';
Config::load(); //加载区域结点配置
$accessKeyId = config('alisms_appkey');
$accessKeySecret = config('alisms_appsecret');
$templateParam = $tplParam; //模板变量替换
$signName = config('alisms_signname');
//短信模板ID
$templateCode = $tplCode;
$product = "Dysmsapi";
$domain = "dysmsapi.aliyuncs.com";
$region = "cn-hangzhou";
$profile = DefaultProfile::getProfile($region, $accessKeyId, $accessKeySecret);
// 增加