Exemplo n.º 1
0
 /**
  * @param RequestPasswordReset $command
  * @return \Flarum\Core\User
  * @throws ModelNotFoundException
  */
 public function handle(RequestPasswordReset $command)
 {
     $user = $this->users->findByEmail($command->email);
     if (!$user) {
         throw new ModelNotFoundException();
     }
     $token = PasswordToken::generate($user->id);
     $token->save();
     $data = ['{username}' => $user->username, '{url}' => $this->url->toRoute('resetPassword', ['token' => $token->id]), '{forum}' => $this->settings->get('forum_title')];
     $body = $this->translator->trans('core.email.reset_password.body', $data);
     $this->mailer->raw($body, function (Message $message) use($user, $data) {
         $message->to($user->email);
         $message->subject('[' . $data['{forum}'] . '] ' . $this->translator->trans('core.email.reset_password.subject'));
     });
     return $user;
 }
 /**
  * Execute the job.
  *
  * @param  Mailer  $mailer
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $mailer->raw('You have received a new purchase of ' . $this->receipt->product->credits . ' credits for ' . $this->receipt->price, function ($message) {
         $message->from('*****@*****.**', 'Whatscarrier');
         $message->subject('You have received new purchase')->to('*****@*****.**');
     });
 }
 /**
  * {@inheritdoc}
  */
 public function handle(ServerRequestInterface $request)
 {
     $id = array_get($request->getQueryParams(), 'id');
     $actor = $request->getAttribute('actor');
     $this->assertRegistered($actor);
     if ($actor->id != $id || $actor->is_activated) {
         throw new PermissionDeniedException();
     }
     $token = EmailToken::generate($actor->email, $actor->id);
     $token->save();
     $data = ['{username}' => $actor->username, '{url}' => $this->url->toRoute('confirmEmail', ['token' => $token->id]), '{forum}' => $this->settings->get('forum_title')];
     $body = $this->translator->trans('core.email.activate_account.body', $data);
     $this->mailer->raw($body, function (Message $message) use($actor, $data) {
         $message->to($actor->email);
         $message->subject('[' . $data['{forum}'] . '] ' . $this->translator->trans('core.email.activate_account.subject'));
     });
     return new EmptyResponse();
 }
Exemplo n.º 4
0
 /**
  * @param \Flarum\Event\UserEmailChangeWasRequested $event
  */
 public function whenUserEmailChangeWasRequested(UserEmailChangeWasRequested $event)
 {
     $email = $event->email;
     $data = $this->getEmailData($event->user, $email);
     $body = $this->translator->trans('core.email.confirm_email.body', $data);
     $this->mailer->raw($body, function (Message $message) use($email, $data) {
         $message->to($email);
         $message->subject('[' . $data['{forum}'] . '] ' . $this->translator->trans('core.email.confirm_email.subject'));
     });
 }
Exemplo n.º 5
0
 /**
  * E-mail the output of the event to the recipients.
  *
  * @param  \Illuminate\Contracts\Mail\Mailer  $mailer
  * @param  array  $addresses
  * @param  bool  $onlyIfOutputExists
  * @return void
  */
 protected function emailOutput(Mailer $mailer, $addresses, $onlyIfOutputExists = false)
 {
     $text = file_get_contents($this->output);
     if ($onlyIfOutputExists && empty($text)) {
         return;
     }
     $mailer->raw($text, function ($m) use($addresses) {
         $m->subject($this->getEmailSubject());
         foreach ($addresses as $address) {
             $m->to($address);
         }
     });
 }
Exemplo n.º 6
0
 /**
  * E-mail the output of the event to the recipients.
  *
  * @param  \Illuminate\Contracts\Mail\Mailer  $mailer
  * @param  array  $addresses
  * @return void
  */
 protected function emailOutput(Mailer $mailer, $addresses)
 {
     $mailer->raw(file_get_contents($this->output), function ($m) use($addresses) {
         $m->subject($this->getEmailSubject());
         foreach ($addresses as $address) {
             $m->to($address);
         }
     });
 }
 /**
  * 受け取ったイベントをメールで送信する
  */
 public function handle(HubConnectionBaseEvent $event)
 {
     $this->mailer->raw($event, function ($m) {
         $m->to('*****@*****.**', '自分')->subject('Hubサイトのメール通知');
     });
 }
 public function send()
 {
     $this->mailer->raw($this->message, function (Message $message) {
         $message->subject($this->subject)->from($this->config['from'])->to($this->config['to']);
     });
 }
Exemplo n.º 9
0
 /**
  * Send raw message
  *
  * @param $text
  * @param $subject
  * @param $to
  */
 public function sendRaw($text, $subject, $to)
 {
     $this->mailer->raw($text, function ($message) use($subject, $to) {
         $message->to($to)->subject($subject);
     });
 }