本文整理汇总了PHP中email::sendCloudMail方法的典型用法代码示例。如果您正苦于以下问题:PHP email::sendCloudMail方法的具体用法?PHP email::sendCloudMail怎么用?PHP email::sendCloudMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类email
的用法示例。
在下文中一共展示了email::sendCloudMail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendlinkEmail
/**
* 发送链接到邮箱
*/
public function SendlinkEmail()
{
$template_name = $this->input['template_name'];
$this->getEmail();
$link_url = $this->input['link_url'];
$identifierUserSystem = new identifierUserSystem();
$identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
//多用户系统
if ($email = trimall($this->input['email'])) {
$nick_name = '用户';
$appicon = '';
$appname = '找回密码';
if (hg_check_email_format($email)) {
$condition = " AND platform_id='" . $email . "' AND mb.type='email' AND mb.identifier=" . $identifier . "";
$leftjoin = " LEFT JOIN " . DB_PREFIX . "member_bind as mb ON m.member_id=mb.member_id ";
$memberInfo = $this->Members->get_member_info($condition, $field = ' mb.* ', $leftjoin, '', false);
$nick_name = $memberInfo['nick_name'];
}
$this->type = 'resetpassword';
$this->verify_email();
$this->_expire_time = $this->settings['email_token_limit']['time_limit'] ? TIMENOW + $this->settings['email_token_limit']['time_limit'] : TIMENOW + 1000;
$condition = " AND email='" . $email . "' AND status=0";
$email_token_info = $this->email_token->show($condition, ' ORDER BY id DESC ', 'limit 1');
if (!$email_token_info) {
$this->token = $this->makeToken(16);
} else {
$this->token = $email_token_info[0]['token'];
//如果该验证码已经过期就重新生成验证码
if ($email_token_info[0]['expire_time'] < TIMENOW) {
$this->token = $this->makeToken(16);
$this->email_token->update($email, array('status' => 1));
} else {
//如果没有过期,过期时间还是原来的
$this->_expire_time = $email_token_info[0]['expire_time'];
}
}
$url = $link_url . '&email=' . $email . '&token=' . $this->token;
//准备发送邮件
$sub = $this->input['sub'];
$preg = array();
$replace = array();
if (!empty($sub)) {
foreach ($sub as $k => $v) {
array_push($preg, "{$k}");
array_push($replace, "{$v}");
}
}
if ($replace) {
foreach ($replace as $k => $v) {
if ($v == '{membername}') {
$replace[$k] = $nick_name;
}
if ($v == '{link_url}') {
$replace[$k] = $url;
}
}
}
$htmlBody = file_get_contents(ROOT_DIR . 'email_template/' . $template_name . '.html');
$content = str_replace($preg, $replace, $htmlBody);
include ROOT_PATH . 'lib/class/email.class.php';
$emailapi = new email();
$param = array('email' => $email, 'content' => $content, 'template_name' => $template_name, 'from' => $this->input['from'], 'fromname' => $this->input['fromname']);
$result = $emailapi->sendCloudMail($param);
$data = array('email' => $this->email, 'type' => $this->type, 'status' => 0, 'token' => $this->token, 'create_time' => TIMENOW, 'expire_time' => TIMENOW + $this->settings['email_token_limit']['time_limit']);
$res = $this->email_token->create($data);
$this->addItem($data);
$this->output();
}
}