public static function send($action = '', $object1 = null)
 {
     Log::info('--- Triggered email: ' . $action . ' ---');
     $base = Config::get('app.url');
     $bcc = array();
     $result = false;
     $sender = array('email' => Config::get('mail.from.address'), 'name' => Config::get('mail.from.name'));
     switch ($action) {
         case 'lost_password':
             $title = 'Request for password';
             $content = array();
             if ($object1 instanceof ResetKey) {
                 $receiver = $object1->user->email;
                 $content = array('firstname' => $object1->user->firstname, 'lastname' => $object1->user->lastname, 'expiration' => $object1->expiration_date->format('d F Y - H:i:s'), 'url' => URL::to('v1/users/reset/' . $object1->key));
             }
             $result = EmailTrigger::email('trig_lost_password', $title, $content, $receiver, $sender, $bcc);
             break;
         default:
             Log::info('<!!!> Email action ' . $action . ' is not valid!');
             break;
     }
     Log::info('--- End Trigger ---');
     return $result;
 }
 /**
  *	Initiate request for new password
  */
 public function forgot()
 {
     $input = Input::all();
     $validator = Validator::make($input, User::getForgotRules());
     if ($validator->passes()) {
         $user = User::where('email', '=', $input['email'])->first();
         $reset = $user->generateResetKey();
         $sent = false;
         if ($reset->save()) {
             Log::info($reset);
             $sent = EmailTrigger::send('lost_password', $reset);
         }
         if ($sent) {
             return ApiResponse::json('Email sent successfully.');
         } else {
             return ApiResponse::json('An error has occured, the Email was not sent.', 500);
         }
     } else {
         return ApiResponse::validation($validator);
     }
 }