コード例 #1
0
ファイル: WindSmtpMail.php プロジェクト: ccq18/EduSoho
 /**
  * @param WindMail $mail 
  * @see IWindSendMail::send()
  */
 public function send($mail, $config = array())
 {
     if ($this->smtp === null) {
         $this->_init($config);
         $this->smtp = new WindSmtp($this->host, $this->port, $this->timeout);
     }
     $this->smtp->open();
     $this->smtp->ehlo($this->name);
     if ($this->auth) {
         $this->smtp->authLogin($this->username, $this->password);
     }
     $this->smtp->mailFrom($mail->getFrom());
     foreach ($mail->getRecipients() as $rcpt) {
         $this->smtp->rcptTo($rcpt);
     }
     $this->smtp->data($mail->createHeader() . $mail->createBody());
     $this->smtp->quit();
     return true;
 }