Esempio n. 1
0
File: Smtp.php Progetto: wuxw/YYF
 /**
  * SMTP DATA
  * SUCCESS 354
  * SUCCESS 250
  * @return $this
  * @throws Exception
  * @throws Exception
  */
 protected function data()
 {
     $in = "DATA" . $this->CRLF;
     $code = $this->pushStack($in);
     if ($code !== '354') {
         throw new Exception('354' . $code . ']' . array_pop($this->resultStack));
     }
     $in = $this->message->toString();
     $code = $this->pushStack($in);
     if ($code !== '250') {
         throw new Exception('250' . $code . ']' . array_pop($this->resultStack));
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * 发送邮件
  * @method send
  * @param  [string] $from 	[发送方邮箱]
  * @param  [string] $to   	[接收方邮箱]
  * @param  [array] 	$msg  	[发送信息]
  * @return [bool]     		[发送结果]
  * @author NewFuture
  */
 public function send($from, $to, $msg)
 {
     $Message = new Message();
     $Message->setFrom($from['name'], $from['email'])->addTo($to['name'], $to['email'])->setSubject($msg['title'])->setBody($msg['body']);
     return $this->_smtp->setAuth($from['email'], $from['pwd'])->send($Message);
 }