Send a welcome email to test mail settings.

@param Request $request
@param string  $displayName
@param string  $email
962908
private function notifyUserSetupEmail(Request $request, $displayName, $email)
    {
        $logger = $this->app['logger.system'];
        $mailer = $this->app['mailer'];
        $transport = $this->app['swiftmailer.spooltransport'];

        // Create a welcome email
        $mailHtml = $this->app['twig']->render(
            '@bolt/email/firstuser.twig',
            ['context' => ['sitename' => $this->getOption('general/sitename')]]
        );

        $name = $this->getOption('general/mailoptions/senderName', $this->getOption('general/sitename'));
        $sendermail = $this->getOption('general/mailoptions/senderMail', 'bolt@' . $request->getHost());
        $from = [$sendermail => $name];
        $email = $this->getOption('general/mailoptions/senderMail', $email);
        try {
            /** @var Message $message */
            $message = $mailer
                ->createMessage('message')
                ->setSubject(Trans::__('general.bolt-new-site-set-up'))
                ->setFrom($from)
                ->setReplyTo($from)
                ->setTo([$email   => $displayName])
                ->setBody($mailHtml, 'text/html')
                ->addPart(preg_replace('/^[\t ]+|[\t ]+$/m', '', strip_tags($mailHtml)), 'text/plain')
                ->setPriority(Message::PRIORITY_HIGH);
        } catch (RfcComplianceException $e) {
            // Sending message failed. What else can we do, send via snailmail?
            $logger->critical("The email address set in 'mailoptions/senderMail' is not a valid email address.", ['event' => 'exception', 'exception' => $e]);

            return;
        }

        try {
            // Try and send immediately
            $failedRecipients = [];
            $mailer->send($message, $failedRecipients);
            $transport->getSpool()->flushQueue($this->app['swiftmailer.transport']);
        } catch (TransportException $e) {
            // Sending message failed. What else can we do, send via snailmail?
            $logger->error("The 'mailoptions' need to be set in app/config/config.yml", ['event' => 'config']);
        }
    }
1223804
function sendEmailToServer(formName){
  var email = $('#' + formName + ' [name=ep_email]').val();
  var userId = pad.getUserId();
  var message = {};
  message.type = 'USERINFO_UPDATE';
  message.userInfo = {};
  message.padId = pad.getPadId();
  message.userInfo.email = email;
  message.userInfo.email_option = $('#' + formName + ' [name=ep_email_option]').val();
  message.userInfo.email_onStart = $('#' + formName + ' [name=ep_email_onStart]').is(':checked');
  message.userInfo.email_onEnd = $('#' + formName + ' [name=ep_email_onEnd]').is(':checked');
  message.userInfo.formName = formName;
  message.userInfo.userId = userId;
  if(email){
    pad.collabClient.sendMessage(message);
  }
}
43084
@SuppressWarnings("WeakerAccess")
  public CreateInstanceRequest setDisplayName(@Nonnull String displayName) {
    Preconditions.checkNotNull(displayName);
    builder.getInstanceBuilder().setDisplayName(displayName);
    return this;
  }
908955
public function forward(SendTestRequest $request)
    {
        $campagne = $this->campagne->find($request->input('id'));
        $sujet    = ($campagne->status == 'brouillon' ? 'TEST | '.$campagne->sujet : $campagne->sujet );

        // GET html
        $html  = $this->worker->html($campagne->id);
        $email = $request->input('email');
        
        \Mail::send([], [], function ($message) use ($html,$email,$sujet) {
            $message->to($email)->subject($sujet)->setBody($html, 'text/html');
        });

        // If we want to send via ajax just add a send_type "ajax
        $ajax = $request->input('send_type', 'normal');

        if($ajax == 'ajax') {
            echo 'ok'; exit;
        }

        alert()->success('Email de test envoyé!');

        return redirect('build/campagne/'.$campagne->id);
    }
287243
public function sendNewUser(string $email, string $username, string $password): void
	{
		$mail = $this->createMail('newUser');

		$mail->link = $this->link('Cms:Sign:in');
		$mail->username = $username;
		$mail->password = $password;

		$mail->setSubject('cms.mailing.newUser.subject')
			->addTo($email);

		$mail->send();
	}
219322
public function webViewAction(Request $request, $token)
    {
        // find email recipients, template & params
        $sentEmail = $this->getSentEmailForToken($token);

        // check if the sent email is available
        if (null !== $sentEmail) {
            // check if the current user is allowed to see the email
            if ($this->userIsAllowedToSeeThisMail($sentEmail)) {
                $template = $sentEmail->getTemplate();
                $emailVars = $sentEmail->getVariables();

                // re-attach all entities to the EntityManager.
                $this->reAttachAllEntities($emailVars);

                // remove the web-view-token from the param-array
                $templateProvider = $this->getTemplateProviderService();
                unset($emailVars[$templateProvider->getWebViewTokenId()]);

                // render & return email
                $response = $this->renderResponse("$template.html.twig", $emailVars);

                $campaignParams = $templateProvider->getCampaignParamsFor($template, $emailVars);

                if (null != $campaignParams && sizeof($campaignParams) > 0) {
                    $response->setContent($this->get('azine.email.bundle.twig.filters')->addCampaignParamsToAllUrls($response->getContent(), $campaignParams));
                }

                return $response;

                // if the user is not allowed to see this mail
            }
            $msg = $this->get('translator')->trans('web.pre.view.test.mail.access.denied');
            throw new AccessDeniedException($msg);
        }

        // the parameters-array is null => the email is not available in webView
        $days = $this->getParameter('azine_email_web_view_retention');
        $response = $this->renderResponse('AzineEmailBundle:Webview:mail.not.available.html.twig', array('days' => $days));
        $response->setStatusCode(404);

        return $response;
    }
710773
public function contactUs(Request $request)
    {
        $this->validate($request, [
            'full_name' => 'required',
            'email' => 'required',
            'subject' => 'required',
            'message' => 'required'
        ]
       );
        Mail::send(
            'page::emails.contact-info', ['data' => $request->all()], function (Message $message) use ($request) {
            $message->from(config("mail.username"), ': Contact request');
            $message->to($this->config("mail.username"), 'CTSFLA')
                ->subject('Contact request');
        }
        );
        return back()->with('success', config('pagekit.contact_us_response', 'Your message has been sent. Thank you!'));
    }
288482
private function sendEmail($to = '', $subject = '', $messageText = '')
    {
        $transport = $this->getServiceLocator()->get('mail.transport');
        $message = new Message();
            
        $message->addTo($to)
                ->addFrom($this->getOptions()->getSenderEmailAdress())
                ->setSubject($subject)
                ->setBody($messageText);

        $transport->send($message);
    }
1059781
public function sendEmail($email)
    {
        $user = $this->users->where('email', $email)->first();

        if (! is_null($user)) {
            $user->generatePasswordResetToken();
        }
    }
358492
public function initInscription($username, $email, $urlReturn) {

        try {
            $error = array();

            $oneClickInscriptionInput = new oneClickInscriptionInput();

            /** nombre de usuario */
            $oneClickInscriptionInput->username = $username;

            /** email */
            $oneClickInscriptionInput->email = $email;

            /** url de respuesta */
            $oneClickInscriptionInput->responseURL = $urlReturn;

            $initInscriptionResponse = $this->_initInscription(
                    array("oneClickInscriptionInput" => $oneClickInscriptionInput)
            );

            /** Validación de firma del requerimiento de respuesta enviado por Webpay */
            $xmlResponse = $this->soapClient->__getLastResponse();
            $soapValidation = new SoapValidation($xmlResponse, $this->config->getWebpayCert());
            $validationResult = $soapValidation->getValidationResult();

            /** Valida conexion a Webpay. Caso correcto retorna URL y Token */
            if ($validationResult === TRUE) {

                $oneClickInscriptionOutput = $initInscriptionResponse->return;
                return $oneClickInscriptionOutput;

            } else {

                $error["error"] = "Error validando conexi&oacute;n a Webpay (Verificar que la informaci&oacute;n del certificado sea correcta)";
                $error["detail"] = "No se pudo completar la conexi&oacute;n con Webpay";
            }
        } catch (\Exception $e) {

            $error["error"] = "Error conectando a Webpay (Verificar que la informaci&oacute;n del certificado sea correcta)";

            $replaceArray = array('<!--' => '', '-->' => '');
            $error["detail"] = str_replace(array_keys($replaceArray), array_values($replaceArray), $e->getMessage());
        }

        return $error;
    }
1074326
public function send(RequestInterface $request, MessageInterface $response)
    {
        $cacheKey = $this->generateCacheKeyForRequest($request);

        if ($this->cache->contains($cacheKey)) {
            $this->hits++;

            $cachedResponse = unserialize($this->cache->fetch($cacheKey));
            /* @var $cachedResponse \Buzz\Message\Response */

            $response->setContent($cachedResponse->getContent());
            $response->setHeaders($cachedResponse->getHeaders());

            return;
        }

        $this->misses++;

        $this->client->send($request, $response);

        $this->cache->save($cacheKey, serialize($response), $this->lifetime);
    }
645112
public function sendResetLinkEmail(Request $request)
    {
        $this->validateEmail($request);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.
        $response = $this->broker()->sendResetLink(
            $request->only('email')
        );

        return $response == Password::RESET_LINK_SENT
            ? $this->sendResetLinkResponse($request, $response)
            : $this->sendResetLinkFailedResponse($request, $response);
    }
440434
public function loginWithEmail(Request $request)
  {
    $request->rules = [
      'email' => 'required'
    ];

    $request->validate();

    $provider = $this->provider;

    $info = MagicLink::notify($request, $provider, $this->musk());

    $this->sendMagicLinkNotification($info['email'], $info['token']);
    $this->redirectUser($request->input('email'));
  }
680990
protected function sendNewEmailSimple($body, $subject, $emailTo = '', 
        $emailID = -3, $treeID = -3, $coreID = -3, $userTo = -3)
    {
        $emaTo = [];
        if (is_array($emailTo)) {
            $emaTo = $emailTo;
            $emailTo = $emailTo[1] . ' <' . $emailTo[0] . '>';
        } elseif (trim($emailTo) != '') {
            $emaUsr = User::where('email', $emailTo)->first();
            if ($emaUsr && isset($emaUsr->name)) {
                $emaTo[] = [$emailTo, $emaUsr->name];
            }
        }
        if ($GLOBALS["SL"]->isHomestead()) {
            echo '<div class="container"><h2>' . $subject . '</h2>' . $body . '<hr><hr></div>';
        } else {
            $this->sendEmail($body, $subject, $emaTo);
        }
        return $this->logEmailSent($body, $subject, $emailTo, $emailID, $treeID, $coreID, $userTo);
    }
1270134
public void send(Email email) throws EmailException {
    synchronized (this) {
      EmailConnection connection = openConnection();
      connection.connect();
      
      connection.send(email);
      
      connection.close();
    }
  }
95439
public function setSender(string $email, string $displayName = null) : void
    {
        $this->sender = new Identity($email, $displayName);
    }
1362339
public function setDisplayName($username, $display) {
		// Make sure we're logged in and have a valid access token.
		if (!$this->auth_token || !$this->username) {
			return FALSE;
		}

		$timestamp = parent::timestamp();
		$result = parent::post(
			'/friend',
			array(
				'action' => 'display',
				'display' => $display,
				'friend' => $username,
				'timestamp' => $timestamp,
				'username' => $this->username,
			),
			array(
				$this->auth_token,
				$timestamp,
			)
		);

		return !empty($result->message);
	}