Esempio n. 1
0
 /**
  * Send invite to email
  * @return int
  * @throws \Ffcms\Core\Exception\SyntaxException
  * @throws \Ffcms\Core\Exception\NativeException
  */
 public function make()
 {
     $token = $this->makeInvite();
     // save data in database
     $invObj = new Invite();
     $invObj->email = $this->email;
     $invObj->token = $token;
     $invObj->save();
     // get mailing template
     $template = App::$View->render('user/_inviteMail', ['invite' => $token, 'email' => $this->email]);
     $sender = App::$Properties->get('adminEmail');
     // format SWIFTMailer format
     $mailMessage = \Swift_Message::newInstance(App::$Translate->get('Default', 'You got invite', []))->setFrom([$sender])->setTo([$this->email])->setBody($template, 'text/html');
     // send message
     return App::$Mailer->send($mailMessage);
 }