<xf:title>{$option.title}</xf:title>

<xf:form action="{{ link('options/email-handler-server', $option) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:formrow label="{{ phrase('connection_type') }}">
				{$type|to_upper}
				<xf:hiddenval name="type" value="{$type}" />
			</xf:formrow>

			<xf:set var="$values" value="{{ $type == $option.option_value.type ? $option.option_value : [] }}" />

			<xf:formrow label="{{ phrase('host') }}" rowtype="input">
				<div class="inputGroup">
					<xf:textbox name="host" value="{$values.host}" placeholder="{{ phrase('host') }}" size="40" required="required" />
					<span class="inputGroup-text">:</span>
					<xf:textbox name="port" value="{$values.port}" placeholder="{{ phrase('port') }}" size="5" required="required" />
				</div>
			</xf:formrow>

			<xf:formrow label="{{ phrase('user_name_and_password') }}" rowtype="input">
				<div class="inputGroup">
					<xf:textbox name="username" value="{$values.username}" placeholder="{{ phrase('user_name') }}" autocomplete="off" size="15" />
					<span class="inputGroup-splitter"></span>
					<xf:textbox name="password" placeholder="{{ phrase('password') }}" autocomplete="new-password" type="password" size="15" />
				</div>
			</xf:formrow>

			<xf:radiorow label="{{ phrase('encryption') }}" name="encryption" value="{{ $values.encryption ?: '' }}"
				explain="{{ phrase('openssl_php_extension_required_tls_or_ssl_encryption') }}">

				<xf:option value="">{{ phrase('none') }}</xf:option>
				<xf:option value="tls" disabled="{{ !in_array('tls', $transports) }}">STARTTLS</xf:option>
				<xf:option value="ssl" disabled="{{ !in_array('ssl', $transports) }}">SSL/TLS</xf:option>
			</xf:radiorow>
		</div>
		<xf:submitrow sticky="true" icon="save" />
	</div>
</xf:form>