예제 #1
0
파일: MailTest.php 프로젝트: CFLOVEYR/hook
 public function testMethods()
 {
     $message = Mail::message();
     $message->body('body');
     $this->assertTrue($message->getBody() == 'body');
     $message->contentType('text/html');
     $this->assertTrue($message->getContentType() == 'text/html');
     $message->subject('subject');
     $this->assertTrue($message->getSubject() == 'subject');
     $date = time();
     $message->date($date);
     $this->assertTrue($message->getDate() == $date);
     $message->returnPath('*****@*****.**');
     $this->assertTrue($message->getReturnPath() == '*****@*****.**');
     $message->from('*****@*****.**');
     $this->assertTrue($message->getFrom() == array("*****@*****.**" => NULL));
     $message->from('*****@*****.**', "From");
     $this->assertTrue($message->getFrom() == array("*****@*****.**" => "From"));
     $message->replyTo('*****@*****.**');
     $this->assertTrue($message->getReplyTo() == array('*****@*****.**' => NULL));
     $message->to('*****@*****.**');
     $this->assertTrue($message->getTo() == array('*****@*****.**' => NULL));
     $message->cc('*****@*****.**');
     $this->assertTrue($message->getCc() == array('*****@*****.**' => NULL));
     $message->bcc('*****@*****.**');
     $this->assertTrue($message->getBcc() == array('*****@*****.**' => NULL));
 }
예제 #2
0
 /**
  * Trigger 'forgot password' email
  */
 public function forgotPassword()
 {
     $data = $this->getData();
     $auth = Auth::where('email', $data['email'])->first();
     if (!$auth) {
         throw new Exceptions\NotFoundException("invalid_user");
     }
     if (!isset($data['subject'])) {
         $data['subject'] = 'Forgot your password?';
     }
     $body_data = Context::unsafe(function () use(&$auth) {
         $array = $auth->generateForgotPasswordToken()->toArray();
         $array['token'] = $auth->getAttribute(Auth::FORGOT_PASSWORD_FIELD);
         return $array;
     });
     $template = isset($data['template']) ? $data['template'] : self::TEMPLATE_FORGOT_PASSWORD;
     return array('success' => Mail::send(array('subject' => $data['subject'], 'from' => Config::get('mail.from', '*****@*****.**'), 'to' => $auth->email, 'body' => Module::template($template)->compile($body_data))) === 1);
 }
예제 #3
0
파일: Message.php 프로젝트: CFLOVEYR/hook
 /**
  * Send the message using
  *
  * @param boolean $sent
  */
 public function send()
 {
     return Mail::send($this);
 }