You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
<?php
|
|
|
|
/**
|
|
* 邮件发送驱动
|
|
*/
|
|
|
|
namespace libraries\send;
|
|
|
|
class EmailDriver implements SendInterface{
|
|
|
|
protected $config = array(
|
|
'smtp_host' => 'smtp.exmail.qq.com', //smtp主机
|
|
'smtp_port' => '25', //端口号
|
|
'smtp_ssl' => true, //安全链接
|
|
'smtp_username' => 'service@ecmoban.com', //邮箱帐号
|
|
'smtp_password' => '123456aA', //邮箱密码
|
|
'smtp_from_to' => 'service@ecmoban.com', //发件人邮箱
|
|
'smtp_from_name' => 'ECTouch', //发件人
|
|
);
|
|
protected $errorMsg = '';
|
|
protected $email;
|
|
|
|
public function __construct( $config = array() ) {
|
|
$this->config = array_merge($this->config, $config);
|
|
$this->mail = new \libraries\Email($this->config);
|
|
}
|
|
|
|
/**
|
|
* 发送邮件
|
|
* @param string $to 收信人
|
|
* @param string $title 标题
|
|
* @param string $content 内容
|
|
* @param array $data 其他数据
|
|
* @return array
|
|
*/
|
|
public function push($to, $title, $content, $time = '', $data = array()) {
|
|
return $this->mail->setMail($title, $content)->sendMail($to);
|
|
}
|
|
|
|
public function getError(){
|
|
return $this->mail->getError();
|
|
}
|
|
}
|