<xf:title>{{ phrase('email_users') }}</xf:title>
<xf:description>{{ phrase('email_users_description') }}</xf:description>

<xf:if is="$sent">
	<div class="blockMessage blockMessage--success blockMessage--iconic">
		{{ phrase('your_email_was_sent_to_x_users', {'sent': $sent|number}) }}
	</div>
</xf:if>

<xf:form action="{{ link('users/email/confirm') }}" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:checkboxrow>
				<xf:option name="list_only">{{ phrase('only_generate_list_of_email_addresses') }}</xf:option>
			</xf:checkboxrow>

			<xf:textboxrow name="from_name" value="{{ $xf.options.emailSenderName ? $xf.options.emailSenderName : $xf.options.boardTitle }}"
				label="{{ phrase('from_name') }}" />

			<xf:textboxrow name="from_email" value="{$xf.options.defaultEmailAddress}" type="email"
				label="{{ phrase('from_email') }}"/>

			<hr class="formRowSep" />

			<xf:textboxrow name="email_title"
				label="{{ phrase('email_title') }}" />

			<xf:radiorow name="email_format"
				label="{{ phrase('email_format') }}">

				<xf:option value="" selected="true"
					label="{{ phrase('plain_text') }}" />
				<xf:option value="html"
					label="HTML"
					hint="{{ phrase('note_that_email_clients_handle_html_in_widely_varying_ways') }}" />
			</xf:radiorow>

			<xf:codeeditorrow name="email_body"
				mode="html" data-line-wrapping="true"
				class="codeEditor--autoSize codeEditor--proportional"
				label="{{ phrase('email_body') }}"
				explain=" {{ phrase('following_placeholders_will_be_replaced_in_message_for_email') }} {{ phrase('you_may_also_use_phrase_title_which_will_be_replaced') }}" />

			<xf:checkboxrow>
				<xf:option name="email_wrapped" selected="true"
					label="{{ phrase('include_default_email_wrapper') }}"
					hint="{{ phrase('include_default_email_wrapper_explain') }}" />
				<xf:option name="email_unsub" selected="true"
					label="{{ phrase('automatically_include_unsubscribe_link') }}"
					hint="{{ phrase('automatically_include_unsubscribe_link_desc') }}" />
			</xf:checkboxrow>
		</div>

		<h2 class="block-formSectionHeader"><span class="block-formSectionHeader-aligner">{{ phrase('user_criteria') }}</span></h2>
		<div class="block-body">
			<xf:checkboxrow>
				<xf:option name="criteria[Option][receive_admin_email]" selected="true">
					{{ phrase('only_send_to_users_opting_to_receive_emails_from_admin') }}
				</xf:option>
			</xf:checkboxrow>

			<xf:include template="helper_user_search_criteria" />
		</div>

		<xf:submitrow submit="{{ phrase('proceed...') }}" sticky="true" />
	</div>
</xf:form>