public function __construct()
{
$className = Utils::getShortName($this);
$this->isAvailable();
$config = Option::get('MAIL_' . $className);
if (!$config) {
throw new Error("邮件模块 " . $className . " 配置不完整,无法使用。");
}
$this->config = json_decode($config, true);
$this->setFrom($this->config['from']);
//设置发件人 格式为( 发件人名称 <[email protected]> )
$this->setAddress($this->config['smtp_name']);
//
if ($this->config['smtp_ssl'] == 'ssl') {
//ssl 模式
$this->setServer($this->config['server'], $this->config['smtp_name'], $this->config['smtp_pass'], 465, true);
} else {
// 非ssl
$this->setServer($this->config['server'], $this->config['smtp_name'], $this->config['smtp_pass']);
}
}