亿美
可自定义短信内容;腾讯
基于内容发送,但内容的格式,要与腾讯后台设置的模板一致;$sms = new extSms();
$code = rand(12345, 98765);
# 基于内容短信
$data = "您的验证码{$code},该验证码5分钟内有效,请勿泄漏于他人!【贴心猫】";
$res = $sms->sendSMS('13800138000', $data);
# 基于模板短信
$res = $sms->sendTid('13537432147', ['code'=>$code]);
简单调用
$to = '10000@qq.com';
$title = '周日锻炼计划';
$body = '周日锻炼计划:爬山,睡觉!';
$vname = '和平鸽';
$em = new extEmail();
$res = $em->send($to, $title, $body, $vname);
设置邮件模板调用
### sy_user.php 邮件模板设置
$_sy_user['utpls'] = array(
//'idpwd' => '',
'mail-act' => "umc:uio/mail-regact", // 注册激活邮件:模板地址
'sms-vcode' => "您的注册验证码是:{code} $signmsg",
//'mail-vcode' => 'umc:uio/reg-xxx.html',
//'sms-act' => '您的激活验证码是:{code} $signmsg',
'mail-getpw' => "umc:uio/mail-getpw", // 找回密码邮件:模板地址
'mail-order' => "umc:uio/mail-order", // order通知:模板地址
);
### code
$ucfg = read('user','sy');
$emtpl = $ucfg['utpls']['mail-order'];
$sys_name = cfg('sys_name');
$re3['act'] = $act;
$re3['site'] = $sys_name;
$re3['time'] = date('Y-m-d H:i');
$re3['root'] = 'http://www.xxx_yyy.com';
$re3 = $re3 + $order;
$detail = vopTpls::show($emtpl,'',$re3); // dump($detail);
$mail = new extEmail();
$rem = $mail->send($order['memail'],"Order Notice({$re3['cid']})",$detail,$sys_name);
// log,return
if($rem=='SentOK'){
$msg = "Send Order Notice Mail [SentOK]";
}else{
$msg = "Send Mail Error ($rem)";
}
### {views}/umc/uio/mail-order 模板文件略