Sends an email to all super users if there is an update available for any plugins from the Marketplace.
For each update we send an email only once.

@return bool
324413
public function sendNotificationIfUpdatesAvailable()
    {
        $pluginsHavingUpdate = $this->getPluginsHavingUpdate();

        if (empty($pluginsHavingUpdate)) {
            return;
        }

        $pluginsToBeNotified = array();

        foreach ($pluginsHavingUpdate as $plugin) {
            if ($this->hasNotificationAlreadyReceived($plugin)) {
                continue;
            }

            $this->setHasLatestUpdateNotificationReceived($plugin);

            $pluginsToBeNotified[] = $plugin;
        }

        if (!empty($pluginsToBeNotified)) {
            $this->sendNotifications($pluginsToBeNotified);
        }
    }
551110
public function update()
    {
        $inputs = Input::all();
        $s      = $this->request->session();
        $route  = uri();

        $session = $s->get($route, []);
        if (empty($session)) {
            return false;
        }
        if (is_null($column = array_get($inputs, 'column'))) {
            return false;
        }
        if (!isset($session[$column]['values'])) {
            return false;
        }

        $old        = !is_null($serialized = array_get($inputs, 'serialized')) ? unserialize($serialized) : array_get($inputs, 'old');
        $new        = array_get($inputs, 'new');
        $index      = array_search($old, $session[$column]['values']);
        if ($index !== false) {
            unset($session[$column]['values'][$index]);
        }
        $session[$column]['values'][] = $new;

        $sidebars = $this->adapter->getDeleteSidebarItem($column, $session[$column], $new);
        if (!empty($sidebars)) {
            $s->put($route, [$column => $session[$column]]);
            $s->save();
            return response(implode('', $sidebars), 200);
        }
    }
377101
public function send()
    {

        if ($this->Logger->isEnabled()) {
            if($this->mailer->IsError())
                $this->Logger->debug("ERROR OCCURRED");

            $this->Logger->debug("Headers:\n".$this->mailer->CreateHeader());
            $this->Logger->debug("Body:\n".$this->mailer->CreateBody());
        }

        if (!$this->testingOnly) {
            try {
                $this->mailer->Send();
            } catch (phpmailerException $e) {
                throw new EmailException($e->getMessage(), $e->getCode());
            }

        }
        return true;
    }
822877
public function sendEmail()
    {
        /* @var $user User */
        $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User';
        $user = $class::findOne([
            'status' => UserStatus::ACTIVE,
            'email' => $this->email,
        ]);

        if ($user) {
            if (!ResetPassword::isPasswordResetTokenValid($user->password_reset_token)) {
                $user->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
            }

            if ($user->save()) {
                return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])
                    ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
                    ->setTo($this->email)
                    ->setSubject('Password reset for ' . Yii::$app->name)
                    ->send();
            }
        }

        return false;
    }
1250957
public function send()	{

		$this->buildHeaders();
		$this->buildMsg();

		if (!self::$debug) {
			return $this->sendMail();
		}

		$headers = [];
		foreach($this->headers as $k => $v) {
			$headers[] = "$k: $v";
		}
		echo '<div style="border: solid 2px #888; background:#efe; font-family: monospace; font-size: 1em; padding: 1em; margin: 1em;">';
		echo is_array($this->receiver) ? implode(', ', $this->receiver) : $this->receiver, '<hr>';
		echo implode('<br>', $headers), '<hr>', $this->subject, '<hr>', nl2br($this->msg);
		echo '</div>';

		return true;

	}
287342
public function sendEmailVerification() {
    if (!isset($this->guid)) {
      return false;
    }
    $success = true;
    if (isset($this->secret) && !isset($this->cancelEmailSecret)) {
      // phpcs:ignore Generic.Files.LineLength.TooLong
      $link = htmlspecialchars(Tilmeld::$config['setup_url'].(strpos(Tilmeld::$config['setup_url'], '?') ? '&' : '?').'action=verifyemail&id='.$this->guid.'&secret='.$this->secret);
      $macros = [
        'verify_link' => $link,
        'to_phone' => htmlspecialchars(
            \uMailPHP\Mail::formatPhone($this->phone)
        ),
        'to_timezone' => htmlspecialchars($this->timezone),
        'to_address' =>
          $this->addressType == 'us'
            ?
              htmlspecialchars(
                  "{$this->addressStreet} {$this->addressStreet2}"
              ).'<br />'.
              htmlspecialchars(
                  "{$this->addressCity}, {$this->addressState} ".
                    "{$this->addressZip}"
              )
            : '<pre>'.htmlspecialchars($this->addressInternational).'</pre>'
      ];
      $mail = new \uMailPHP\Mail(
          '\Tilmeld\Entities\Mail\VerifyEmail',
          $this,
          $macros
      );
      $success = $success && $mail->send();
    }
    if (isset($this->secret) && isset($this->cancelEmailSecret)) {
      // phpcs:ignore Generic.Files.LineLength.TooLong
      $link = htmlspecialchars(Tilmeld::$config['setup_url'].(strpos(Tilmeld::$config['setup_url'], '?') ? '&' : '?').'action=verifyemailchange&id='.$this->guid.'&secret='.$this->secret);
      $macros = [
        'verify_link' => $link,
        'old_email' => htmlspecialchars($this->cancelEmailAddress),
        'new_email' => htmlspecialchars($this->email),
        'to_phone' => htmlspecialchars(
            \uMailPHP\Mail::formatPhone($this->phone)
        ),
        'to_timezone' => htmlspecialchars($this->timezone),
        'to_address' =>
          $this->addressType == 'us'
            ?
              htmlspecialchars(
                  "{$this->addressStreet} {$this->addressStreet2}"
              ).'<br />'.
              htmlspecialchars(
                  "{$this->addressCity}, {$this->addressState} ".
                    "{$this->addressZip}"
              )
            : '<pre>'.htmlspecialchars($this->addressInternational).'</pre>'
      ];
      $mail = new \uMailPHP\Mail(
          '\Tilmeld\Entities\Mail\VerifyEmailChange',
          $this,
          $macros
      );
      $success = $success && $mail->send();
    }
    if (isset($this->cancelEmailSecret)) {
      // phpcs:ignore Generic.Files.LineLength.TooLong
      $link = htmlspecialchars(Tilmeld::$config['setup_url'].(strpos(Tilmeld::$config['setup_url'], '?') ? '&' : '?').'action=cancelemailchange&id='.$this->guid.'&secret='.$this->cancelEmailSecret);
      $macros = [
        'cancel_link' => $link,
        'old_email' => htmlspecialchars($this->cancelEmailAddress),
        'new_email' => htmlspecialchars($this->email),
        'to_phone' => htmlspecialchars(
            \uMailPHP\Mail::formatPhone($this->phone)
        ),
        'to_timezone' => htmlspecialchars($this->timezone),
        'to_address' =>
          $this->addressType == 'us'
            ?
              htmlspecialchars(
                  "{$this->addressStreet} {$this->addressStreet2}"
              ).'<br />'.
              htmlspecialchars(
                  "{$this->addressCity}, {$this->addressState} ".
                    "{$this->addressZip}"
              )
            : '<pre>'.htmlspecialchars($this->addressInternational).'</pre>'
      ];
      $mail = new \uMailPHP\Mail(
          '\Tilmeld\Entities\Mail\CancelEmailChange',
          $this,
          $macros
      );
      $success = $success && $mail->send();
    }
    return $success;
  }
145324
public function sendEmailAction()
    {
        $email = $this->container->get('request')->request->get('email');

        /**
         * @var $user UserInterface
         */
        $user = $this->container->get('fos_user.user_manager')->findUserByEmail($email);

        if (null === $user) {
            return $this->container->get('templating')->renderResponse(
                'FOSUserBundle:Resetting:request.html.'.$this->getEngine(),
                array('invalid_email' => $email)
            );
        }

        $code = $this->resetEmail($user);
        switch ($code) {
            case self::RESET_EMAIL_ALREADY_SENT:
                return $this->container->get('templating')->renderResponse(
                    'FOSUserBundle:Resetting:passwordAlreadyRequested.html.'.$this->getEngine()
                );
                break;
            case self::RESET_EMAIL_OK:
                return new RedirectResponse(
                    $this->container->get('router')->generate('fos_user_resetting_check_email')
                );
                break;
        }
    }
165569
public function send()
    {
    	if(!$this->getTemplate()->getIsActive())
    	{
    		return $this;
    	}
    	
        if(!$this->isRendered())
	    {
	      $this->render();
	    }
	    
    	$eventParams = array(
    			'mailer'    => $this->getMailer(),
    			'message'   => $this->getMessage(),
    			'template'  => $this->getTemplate()
    	);

    	$this->getMailer()->send($this->getMessage());
    	$this->sentMailer->createSentMail($this->getTemplate());
    
    	return $this;
    }
842428
public function send()
    {
        try {
            if (!$this->preSend()) {
                return false;
            }
            return $this->postSend();
        } catch (phpmailerException $exc) {
            $this->mailHeader = '';
            $this->setError($exc->getMessage());
            if ($this->exceptions) {
                throw $exc;
            }
            return false;
        }
    }
1277256
public function send()
    {
        $to = $this->getToForSend();
        $headers = $this->getHeadersForSend();

        if (empty($to)) {
            throw new \RuntimeException(
                'Unable to send, no To address has been set.'
            );
        }

        if ($this->hasAttachments()) {
            $message  = $this->assembleAttachmentBody();
            $headers .= PHP_EOL . $this->assembleAttachmentHeaders();
        } else {
            $message = $this->getWrapMessage();
        }

        return mail($to, $this->_subject, $message, $headers, $this->_params);
    }
1054528
public function sendEmail()
    {
        $user = User::findOne([
            'email' => $this->email,
            'status' => User::STATUS_INACTIVE
        ]);

        if ($user === null) {
            return false;
        }

        return Yii::$app
            ->mailer
            ->compose(
                ['html' => 'emailVerify-html', 'text' => 'emailVerify-text'],
                ['user' => $user]
            )
            ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
            ->setTo($this->email)
            ->setSubject('Account registration at ' . Yii::$app->name)
            ->send();
    }
1282932
public function send()
    {
        $arguments = func_get_args();
        $method    = array_shift($arguments);
        $args      = array_shift($arguments);

        $helpers = $this->getConfig()->getHelpers();

        return call_user_func_array(array($helpers, $method), $args);
    }
232922
protected function send_mail() {
        // Headers to help prevent auto-responders.
        $userfrom = \core_user::get_noreply_user();
        $userfrom->customheaders = array(
            "Precedence: Bulk",
            'X-Auto-Response-Suppress: All',
            'Auto-Submitted: auto-generated',
        );

        $eventdata = new \core\message\message();
        $eventdata->courseid = SITEID;
        $eventdata->component = 'mod_forum';
        $eventdata->name = 'digests';
        $eventdata->userfrom = $userfrom;
        $eventdata->userto = $this->recipient;
        $eventdata->subject = $this->postsubject;
        $eventdata->fullmessage = $this->notificationtext;
        $eventdata->fullmessageformat = FORMAT_PLAIN;
        $eventdata->fullmessagehtml = $this->notificationhtml;
        $eventdata->notification = 1;
        $eventdata->smallmessage = get_string('smallmessagedigest', 'forum', $this->sentcount);

        return message_send($eventdata);
    }
164918
public function send()
    {
        if (!$this->_user->has('email') || !$this->_user->has('name')) {
            throw new BadMethodCallException(__d('user', 'Missing "name" or "email" property when trying to send the email.'));
        }

        if ($this->config('updateToken') === true) {
            $this->loadModel('User.Users');
            $this->_user->updateToken();
        }

        $subject = $this->_parseVariables((string)$this->subject());
        $body = $this->_parseVariables((string)$this->body());

        if (empty($subject) || empty($body)) {
            return false;
        }

        $sender = new Email($this->config('emailConfig'));
        $sent = false;
        try {
            $sent = $sender
                ->to($this->_user->get('email'), $this->_user->get('name'))
                ->subject($subject)
                ->send($body);
        } catch (\Exception $e) {
            return false;
        }

        return $sent;
    }
990730
public function callbackSubmit()
    {
        $email       = $this->form->value("email");
        $name        = $this->form->value("name");
        $password      = $this->form->value("password");
        $passwordAgain = $this->form->value("password-again");
        // Check password matches
        if ($password !== $passwordAgain) {
            $this->form->rememberValues();
            $this->form->addOutput("Lösenordet stämmer inte överens.");
            return false;
        }

        $user = new User();
        $user->setDb($this->di->get("db"));

        if (!$user->isEmailUnique($email)) {
            $this->form->rememberValues();
            $this->form->addOutput("E-postadressen är redan registrerad.");
            return false;
        }

        $user->email = $email;
        $user->name = $name;
        $user->setPassword($password);
        $user->created = date("Y-m-d H:i:s");
        $user->active = 1;
        $user->admin = 0;
        $user->save();

        $this->di->get("response")->redirect("user");

        return true;
    }
549152
public function sendEmail()
    {
        /* @var $user \common\models\User */
        $identityClassName = \Yii::$app->user->identityClass;

        $user = $identityClassName::findByUsernameOrEmail($this->identifier);
        //$user = $identityClassName::

        if ($user) {
            if (!$identityClassName::isPasswordResetTokenValid($user->password_reset_token)) {
                $user->generatePasswordResetToken();
            }

            if ($user->save()) {
                if (!$user->email) {
                    return false;
                }

                if ($this->isAdmin) {
                    $resetLink = \skeeks\cms\helpers\UrlHelper::construct('admin/auth/reset-password',
                        ['token' => $user->password_reset_token])->enableAbsolute()->enableAdmin();
                } else {
                    $resetLink = \skeeks\cms\helpers\UrlHelper::construct('cms/auth/reset-password',
                        ['token' => $user->password_reset_token])->enableAbsolute();
                }


                \Yii::$app->mailer->view->theme->pathMap = ArrayHelper::merge(\Yii::$app->mailer->view->theme->pathMap,
                    [
                        '@app/mail' =>
                            [
                                '@skeeks/cms/mail-templates'
                            ]
                    ]);


                $message = \Yii::$app->mailer->compose('@app/mail/password-reset-token', [
                    'user' => $user,
                    'resetLink' => $resetLink
                ])
                    ->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName])
                    ->setTo($user->email)
                    ->setSubject(\Yii::t('skeeks/cms',
                            'The request to change the password for') . \Yii::$app->cms->appName);

                return $message->send();
            }
        }

        return false;
    }
1241922
public static function sendHeaders()
    {
        if (! headers_sent()) {
            foreach (self::$headers as $header) {
                header($header, true);
            }

            return true;
        }

        return false;
    }