SettingsController::email PHP Method

email() public method

Outgoing Email management screen.
Since: 2.0.0
public email ( )
    public function email()
    {
        $this->permission('Garden.Settings.Manage');
        $this->setHighlightRoute('dashboard/settings/email');
        $this->addJsFile('email.js');
        $this->title(t('Outgoing Email'));
        $Validation = new Gdn_Validation();
        $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
        $ConfigurationModel->setField(array('Garden.Email.SupportName', 'Garden.Email.SupportAddress', 'Garden.Email.UseSmtp', 'Garden.Email.SmtpHost', 'Garden.Email.SmtpUser', 'Garden.Email.SmtpPassword', 'Garden.Email.SmtpPort', 'Garden.Email.SmtpSecurity', 'Garden.Email.OmitToName'));
        // Set the model on the form.
        $this->Form->setModel($ConfigurationModel);
        // If seeing the form for the first time...
        if ($this->Form->authenticatedPostBack() === false) {
            // Apply the config settings to the form.
            $this->Form->setData($ConfigurationModel->Data);
        } else {
            // Define some validation rules for the fields being saved
            $ConfigurationModel->Validation->applyRule('Garden.Email.SupportName', 'Required');
            $ConfigurationModel->Validation->applyRule('Garden.Email.SupportAddress', 'Required');
            $ConfigurationModel->Validation->applyRule('Garden.Email.SupportAddress', 'Email');
            if ($this->Form->save() !== false) {
                $this->informMessage(t("Your settings have been saved."));
            }
        }
        $this->render();
    }