public function isSendmail() { $ini_sendmail_path = ini_get('sendmail_path'); if (!stristr($ini_sendmail_path, 'sendmail')) { $this->Sendmail = '/usr/sbin/sendmail'; } else { $this->Sendmail = $ini_sendmail_path; } $this->Mailer = 'sendmail'; }
public function init() { $this->_mailer = new \PHPMailer(); switch ($this->method) { case 'smtp': $this->_mailer->isSMTP(); $this->_mailer->Host = $this->smtp['host']; if (!empty($this->smtp['username'])) { $this->_mailer->SMTPAuth = true; $this->_mailer->Username = $this->smtp['username']; $this->_mailer->Password = $this->smtp['password']; } else { $this->_mailer->SMTPAuth = false; } if (isset($this->smtp['port'])) { $this->_mailer->Port = $this->smtp['port']; } if (isset($this->smtp['secure'])) { $this->_mailer->SMTPSecure = $this->smtp['secure']; } if (isset($this->smtp['debug'])) { $this->_mailer->SMTPDebug = (int) $this->smtp['debug']; } break; case 'sendmail': $this->_mailer->isSendmail(); break; default: $this->_mailer->isMail(); } $this->_mailer->CharSet = \Yii::app()->charset; parent::init(); }