📄 mail.php
字号:
<?php
/*邮件发送*/
class Mail {
public $mail;
public $config;
public function __construct(){
$this->config = $GLOBALS['config'];
$this->mail = new Easy_Mail();
}
public function sendMail($to , $subject, $mailbody){
$array['server'] = $this->config['smtp'];
$array['port'] = $this->config['port'];
$array['user'] = $this->config['smtpuser'];
$array['pass'] = $this->config['smtpass'];
$array['from'] = $this->config['sitemail'];
$this->mail->server[] = $array;
if (is_array($to)){
$this->mail->to = $to;
}else{
$this->mail->to = explode(',', $to);
}
$this->mail->subject = $subject;
if (!$mailbody){
exit('邮件内容必须填写');
}
$mailbody = str_replace('[sitename]', $this->config['sitename'], $mailbody );
$mailbody = str_replace('[domain]', $this->config['domain'], $mailbody );
$mailbody = str_replace('[qq]', $this->config['qq'], $mailbody );
$mailbody = str_replace('[sitemail]', $this->config['sitemail'], $mailbody );
$mailbody = str_replace('[phone]', $this->config['phone'], $mailbody );
$this->mail->htmlbody = $mailbody;
if($this->mail->sendmail()===true){
return true;
}else{
$this->ErrorInfo = $this->mail->ErrorInfo;
return false;
}
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -