core-bundle/src/Resources/contao/modules/ModuleRegistration.php
protected function sendActivationMail($arrData)
	{
		/** @var OptIn $optIn */
		$optIn = System::getContainer()->get('contao.opt-in');
		$optInToken = $optIn->create('reg', $arrData['email'], array('tl_member'=>array($arrData['id'])));

		// Prepare the simple token data
		$arrTokenData = $arrData;
		$arrTokenData['activation'] = $optInToken->getIdentifier();
		$arrTokenData['domain'] = Idna::decode(Environment::get('host'));
		$arrTokenData['link'] = Idna::decode(Environment::get('base')) . Environment::get('request') . ((strpos(Environment::get('request'), '?') !== false) ? '&' : '?') . 'token=' . $optInToken->getIdentifier();
		$arrTokenData['channels'] = '';

		$bundles = System::getContainer()->getParameter('kernel.bundles');

		if (isset($bundles['ContaoNewsletterBundle']))
		{
			// Make sure newsletter is an array
			if (!\is_array($arrData['newsletter']))
			{
				if ($arrData['newsletter'] != '')
				{
					$arrData['newsletter'] = array($arrData['newsletter']);
				}
				else
				{
					$arrData['newsletter'] = array();
				}
			}

			// Replace the wildcard
			if (!empty($arrData['newsletter']))
			{
				$objChannels = NewsletterChannelModel::findByIds($arrData['newsletter']);

				if ($objChannels !== null)
				{
					$arrTokenData['channels'] = implode("\n", $objChannels->fetchEach('title'));
				}
			}
		}

		// Deprecated since Contao 4.0, to be removed in Contao 5.0
		$arrTokenData['channel'] = $arrTokenData['channels'];

		// Send the token
		$optInToken->send(sprintf($GLOBALS['TL_LANG']['MSC']['emailSubject'], Idna::decode(Environment::get('host'))), StringUtil::parseSimpleTokens($this->reg_text, $arrTokenData));
	}
protected function sendActivationMail($arrData)
	{
		/** @var OptIn $optIn */
		$optIn = System::getContainer()->get('contao.opt-in');
		$optInToken = $optIn->create('reg', $arrData['email'], array('tl_member'=>array($arrData['id'])));

		// Prepare the simple token data
		$arrTokenData = $arrData;
		$arrTokenData['activation'] = $optInToken->getIdentifier();
		$arrTokenData['domain'] = Idna::decode(Environment::get('host'));
		$arrTokenData['link'] = Idna::decode(Environment::get('base')) . Environment::get('request') . ((strpos(Environment::get('request'), '?') !== false) ? '&' : '?') . 'token=' . $optInToken->getIdentifier();
		$arrTokenData['channels'] = '';

		$bundles = System::getContainer()->getParameter('kernel.bundles');

		if (isset($bundles['ContaoNewsletterBundle']))
		{
			// Make sure newsletter is an array
			if (!\is_array($arrData['newsletter']))
			{
				if ($arrData['newsletter'] != '')
				{
					$arrData['newsletter'] = array($arrData['newsletter']);
				}
				else
				{
					$arrData['newsletter'] = array();
				}
			}

			// Replace the wildcard
			if (!empty($arrData['newsletter']))
			{
				$objChannels = NewsletterChannelModel::findByIds($arrData['newsletter']);

				if ($objChannels !== null)
				{
					$arrTokenData['channels'] = implode("\n", $objChannels->fetchEach('title'));
				}
			}
		}

		// Deprecated since Contao 4.0, to be removed in Contao 5.0
		$arrTokenData['channel'] = $arrTokenData['channels'];

		// Send the token
		$optInToken->send(sprintf($GLOBALS['TL_LANG']['MSC']['emailSubject'], Idna::decode(Environment::get('host'))), StringUtil::parseSimpleTokens($this->reg_text, $arrTokenData));
	}
protected function sendActivationMail ( $ arrData ) { /** @var OptIn $optIn */ $ optIn = System :: getContainer ( ) -> get ( 'contao.opt-in' ) ; $ optInToken = $ optIn -> create ( 'reg' , $ arrData [ 'email' ] , array ( 'tl_member' => array ( $ arrData [ 'id' ] ) ) ) ; // Prepare the simple token data $ arrTokenData = $ arrData ; $ arrTokenData [ 'activation' ] = $ optInToken -> getIdentifier ( ) ; $ arrTokenData [ 'domain' ] = Idna :: decode ( Environment :: get ( 'host' ) ) ; $ arrTokenData [ 'link' ] = Idna :: decode ( Environment :: get ( 'base' ) ) . Environment :: get ( 'request' ) . ( ( strpos ( Environment :: get ( 'request' ) , '?' ) !== false ) ? '&' : '?' ) . 'token=' . $ optInToken -> getIdentifier ( ) ; $ arrTokenData [ 'channels' ] = '' ; $ bundles = System :: getContainer ( ) -> getParameter ( 'kernel.bundles' ) ; if ( isset ( $ bundles [ 'ContaoNewsletterBundle' ] ) ) { // Make sure newsletter is an array if ( ! \ is_array ( $ arrData [ 'newsletter' ] ) ) { if ( $ arrData [ 'newsletter' ] != '' ) { $ arrData [ 'newsletter' ] = array ( $ arrData [ 'newsletter' ] ) ; } else { $ arrData [ 'newsletter' ] = array ( ) ; } } // Replace the wildcard if ( ! empty ( $ arrData [ 'newsletter' ] ) ) { $ objChannels = NewsletterChannelModel :: findByIds ( $ arrData [ 'newsletter' ] ) ; if ( $ objChannels !== null ) { $ arrTokenData [ 'channels' ] = implode ( "\n" , $ objChannels -> fetchEach ( 'title' ) ) ; } } } // Deprecated since Contao 4.0, to be removed in Contao 5.0 $ arrTokenData [ 'channel' ] = $ arrTokenData [ 'channels' ] ; // Send the token $ optInToken -> send ( sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'emailSubject' ] , Idna :: decode ( Environment :: get ( 'host' ) ) ) , StringUtil :: parseSimpleTokens ( $ this -> reg_text , $ arrTokenData ) ) ; }
Send the activation mail

@param MemberModel $objNewUser
Send the activation mail