@EXT\Route("/mail/server", name="claro_admin_parameters_mail_server")
@EXT\Template
@SEC\PreAuthorize("canOpenAdminTool('platform_parameters')")

@return \Symfony\Component\HttpFoundation\Response
558620
public function mailServerFormAction()
    {
        $platformConfig = $this->configHandler->getPlatformConfig();
        $form = $this->formFactory->create(
            new AdminForm\MailServerType(
                $platformConfig->getMailerTransport(),
                $this->configHandler->getLockedParamaters()
            ),
            $platformConfig
        );

        return array('form_mail' => $form->createView());
    }
857500
public function authorize()
    {
        $response = new Response();

        /** @var Response $response */
        $response = $this->oauthServer->handleAuthorizeRequest(Request::createFromGlobals(), $response, true);
        if (!$response->getParameters()) {
            $code = substr(
                $response->getHttpHeader('Location'),
                strpos($response->getHttpHeader('Location'), 'code=') + 5,
                40
            );
            return $this->response->sendSuccess(['code' => $code]);
        } else {
            return $this->response->sendError(
                ResponseCodes::AUTH_ERROR,
                $response->getStatusCode(),
                $response->getParameter('error_description')
            );
        }
    }
500975
public function handler(): Response
    {
        $mailer = new Mailer([
            'driver' => 'smtp',
            'host' => 'host',
            'port' => 0,
            'encryption' => '',
            'username' => 'username',
            'password' => 'password',
            'sender' => 'sender',
            'remark' => ''
        ]);
        if (Mailer::count() === 0) {
            $mailer->default(true);
        }
        $mailer->save();
        $this->log('info', 'Create a mailer [' . $mailer->getSender() . ']');
        return response([
            'id' => $mailer->getId()
        ]);
    }
320920
public function mailLayoutFormAction()
    {
        $form = $this->formFactory->create(
            new AdminForm\MailLayoutType(),
            $this->mailManager->getMailLayout()
        );

        return array('form' => $form->createView());
    }
733037
public function endMaintenanceAction()
    {
        //the current ip must be whitelisted so it can access the the plateform when it's under maintenance
        MaintenanceHandler::disableMaintenance();
        $this->ipwlm->removeIP($_SERVER['REMOTE_ADDR']);
        return new RedirectResponse($this->router->generate('claro_admin_parameters_index'));
    }
1308324
public function configAction(): Response
    {
        $user = $this->tokenStorage->getToken()->getUser();
        $contact = $this->contactManager->getById($user->getContact()->getId(), $user->getLocale());

        $view = View::create([
            'sulu_admin' => [
                'endpoints' => [
                    'metadata' => $this->urlGenerator->generate(
                        'sulu_admin.metadata',
                        ['type' => ':type', 'key' => ':key']
                    ),
                ],
                'fieldTypeOptions' => $this->fieldTypeOptionRegistry->toArray(),
                'internalLinkTypes' => $this->linkProviderPool->getConfiguration(),
                'navigation' => $this->navigationRegistry->getNavigation()->getChildrenAsArray(),
                'routes' => $this->routeRegistry->getRoutes(),
                'resources' => $this->resources,
                'smartContent' => array_map(function(DataProviderInterface $dataProvider) {
                    return $dataProvider->getConfiguration();
                }, $this->dataProviderPool->getAll()),
                'user' => $user,
                'contact' => $contact,
            ],
            'sulu_contact' => [
                'addressTypes' => $this->managerRegistry->getRepository('SuluContactBundle:AddressType')->findAll(),
                'countries' => $this->managerRegistry->getRepository('SuluContactBundle:Country')->findAll(),
            ],
            'sulu_media' => [
                'endpoints' => [
                    'image_format' => $this->urlGenerator->generate(
                        'sulu_media.redirect',
                        ['id' => ':id']
                    ),
                ],
            ],
            'sulu_preview' => [
                'endpoints' => [
                    'start' => $this->urlGenerator->generate('sulu_preview.start'),
                    'render' => $this->urlGenerator->generate('sulu_preview.render'),
                    'update' => $this->urlGenerator->generate('sulu_preview.update'),
                    'update-context' => $this->urlGenerator->generate('sulu_preview.update-context'),
                    'stop' => $this->urlGenerator->generate('sulu_preview.stop'),
                ],
                'debounceDelay' => $this->previewDelay,
                'mode' => $this->previewMode,
            ],
            'sulu_security' => [
                'endpoints' => [
                    'contexts' => $this->urlGenerator->generate('cget_contexts'),
                ],
            ],
            'sulu_website' => [
                'endpoints' => [
                    'clearCache' => $this->urlGenerator->generate('sulu_website.cache.remove'),
                ],
            ],
        ]);

        $context = new Context();
        $context->setGroups(['frontend', 'partialContact', 'fullRoute']);

        $view->setContext($context);
        $view->setFormat('json');

        return $this->viewHandler->handle($view);
    }
760258
protected function createAdmin()
	{
		$site = Route::input( 'site', Input::get( 'site', 'default' ) );
		$lang = Input::get( 'locale', config( 'app.locale', 'en' ) );
		$resource = Route::input( 'resource' );

		$aimeos = app( 'aimeos' )->get();
		$templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' );

		$context = app( 'aimeos.context' )->get( false, 'backend' );
		$context->setI18n( app('aimeos.i18n')->get( array( $lang, 'en' ) ) );
		$context->setLocale( app('aimeos.locale')->getBackend( $context, $site ) );
		$context->setView( app( 'aimeos.view' )->create( $context, $templatePaths, $lang ) );

		return \Aimeos\Admin\JsonAdm::create( $context, $aimeos, $resource );
	}
896937
public function getMailingListService()
    {
        if (!array_key_exists('mailing_list', $this->services)) {
            $this->services['mailing_list'] = new MailingList($this->httpClient, $this->key);
        }

        return $this->services['mailing_list'];
    }
660657
public function getEmail()
    {
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:auth:accounts:browse')) {
            throw new ApiException(
                'You are not authorised to browse users',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput = Factory::service('Input');
        $sEmail = $oInput->get('email');

        if (!valid_email($sEmail)) {
            throw new ApiException(
                '"' . $sEmail . '" is not a valid email',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        $oUserModel = Factory::model(static::CONFIG_MODEL_NAME, static::CONFIG_MODEL_PROVIDER);
        $oUser      = $oUserModel->getByEmail($sEmail);

        if (empty($oUser)) {
            throw new ApiException(
                'No user found for email "' . $sEmail . '"',
                $oHttpCodes::STATUS_NOT_FOUND
            );
        }

        return Factory::factory('ApiResponse', 'nails/module-api')
            ->setData($this->formatObject($oUser));
    }
527666
protected function getServer()
    {
        $server = new Server();
        $server->setHost($this->getHost())
            ->setRoot($this->getServerRoot())
            ->setBranch($this->getServerBranch())
            ->setCodeVersion($this->getServerCodeVersion());
        $extras = $this->getServerExtras();
        if (!$extras) {
            $extras = array();
        }

        $server->setExtras($extras);
        if (isset($_SERVER) && array_key_exists('argv', $_SERVER)) {
            $server->setArgv($_SERVER['argv']);
        }
        return $server;
    }
224854
public function getSMTPObject()
    {
        if ($this->_smtp) {
            return $this->_smtp;
        }

        $this->_smtp = new Net_SMTP(
            $this->_params['host'],
            $this->_params['port'],
            $this->_params['localhost']
        );

        /* Set pipelining. */
        if ($this->_params['pipelining']) {
            $this->_smtp->pipelining = true;
        }

        /* If we still don't have an SMTP object at this point, fail. */
        if (!($this->_smtp instanceof Net_SMTP)) {
            throw new Horde_Mail_Exception('Failed to create a Net_SMTP object', self::ERROR_CREATE);
        }

        /* Configure the SMTP connection. */
        if ($this->_params['debug']) {
            $this->_smtp->setDebug(true);
        }

        /* Attempt to connect to the configured SMTP server. */
        $res = $this->_smtp->connect($this->_params['timeout']);
        if ($res instanceof PEAR_Error) {
            $this->_error('Failed to connect to ' . $this->_params['host'] . ':' . $this->_params['port'], $res, self::ERROR_CONNECT);
        }

        /* Attempt to authenticate if authentication has been enabled. */
        if ($this->_params['auth']) {
            $method = is_string($this->_params['auth'])
                ? $this->_params['auth']
                : '';

            $res = $this->_smtp->auth($this->_params['username'], $this->_params['password'], $method);
            if ($res instanceof PEAR_Error) {
                $this->_error("$method authentication failure", $res, self::ERROR_AUTH);
            }
        }

        return $this->_smtp;
    }
357014
public function doHttpOptions()
    {
        $methods = implode( ', ', $this->supported_http_methods );
        $result = new ezpRestMvcResult;
        $result->status = new ezpRestStatusResponse(
            ezpHttpResponseCodes::OK,
            'Allowed methods are: ' . $methods,
            array( 'Allow' => $methods )
        );
        return $result;
    }
759882
protected function serverCommand()
    {
        return sprintf('%s -S %s:%s %s',
            ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)),
            $this->host(),
            $this->port(),
            ProcessUtils::escapeArgument(base_path('server.php'))
        );
    }
860103
public function build()
    {
        $mail = $this->from($this->mailData['from'], $this->mailData['from_name'])
                    ->to($this->mailData['to'], $this->mailData['to_name'])
                    ->subject($this->mailData['subject'])
                    ->view($this->mailData['template']);
        if (is_array($this->mailData['files'])) {
            foreach ($this->mailData['files'] as $file) {
                if ($file !== null) {
                    $mail->attach(public_path($file));    
                }
            }
        }
        return $mail;
    }
575752
public function validHost() {
		$hostalias = 'EmailSmtphost';
		$portalias = 'EmailSmtpport';
		$port = CAKE_SETTINGS_APP_SMTP_DEFAULT_PORT;
		$timeLimit = CAKE_SETTINGS_APP_SMTP_TIME_LIMIT;
		if (!isset($this->data[$this->alias][$hostalias]) ||
			empty($this->data[$this->alias][$hostalias])) {
			return true;
		}

		$result = false;
		if (isset($this->data[$this->alias][$portalias]) &&
			ctype_digit($this->data[$this->alias][$portalias])) {
			$port = $this->data[$this->alias][$portalias];
		}

		//@codingStandardsIgnoreStart
		$fp = @fsockopen($this->data[$this->alias][$hostalias], $port, $errno, $errstr, $timeLimit);
		//@codingStandardsIgnoreEnd
		if ($fp) {
			$result = true;
			fclose($fp);
		}

		return $result;
	}
1001627
public function run()
    {
        // TODO: Implement run() method.
        $cnf = Bootstrap::getSingleton()->getConfig();
        $appName = $cnf['app']['name'];
        $email = $this->config['email']?:$this->config['app']['settings']['email']['default'];
        $this->setTemplate("json.twig");
        $mail = new Mail($_POST['email'], $_POST['nombre']);
        $content = $mail->render($this, "mail_template.twig", array('post' => $_POST));
        $mail->send($email, 'Incidencia de ' . $appName, $content, array(), array($_POST['email']));

        return array('json' => array('ok' => true));
    }
254945
public function actionIndex()
    {
        $this->requirePostRequest();
        $request = Craft::$app->getRequest();

        // Set params
        $params = [
          'name' => $request->post('name'),
          'contact' => $request->post('contact'),
          'permission_reminder' => $request->post('permission_reminder'),
          'campaign_defaults' => $request->post('campaign_defaults'),
          'email_type_option' => $request->post('email_type_option') ? true : false
        ];

        // Post request to create list
        $response = HttpService::request('POST', 'lists', $params);

        if ($response['success'] and $response['statusCode'] === 200) {
          Craft::$app->getSession()->setNotice('List created.');
          return $this->redirectToPostedUrl();
        } elseif ($response['success'] and $response['statusCode'] !== 200) {
          Craft::$app->session->setFlash('errorBody', $response['body']);
          Craft::$app->getSession()->setError($response['statusCode'].' '.$response['reason']);
        } else {
          Craft::$app->getSession()->setError($response['reason']);
        }

        return $this->redirect('mailchimp-lists/create');
    }