{if !$user_options_email_have_ssl}
    <div class="warning warningborder ui-corner-all" style="color:red">
        {$i.useroptions_email_no_ssl}
    </div>
{/if}
<table class="editablepop">
    <thead>
        <tr>
            <th scope="col">
                {if !isset($is_qplan) || !$is_qplan}
                    <span onclick="user_options_email.open('add');" class="dialog_make_btn16 add smallbtns ui-corner-all" title="{$i.basic_add}"></span>
                {/if}
            </th>
            {if $show_default_selection}<th scope="col">{$i.useroptions_email_default}</th>{/if}
            <th scope="col">{$i.useroptions_email_email}</th>
            <th scope="col">{$i.useroptions_email_host}</th>
            <th scope="col">{$i.useroptions_email_user}</th>
            <th scope="col">{$i.useroptions_email_mode}</th>
            <th scope="col">{$i.useroptions_email_port}</th>
            <th scope="col">{$i.useroptions_email_imap_mailbox}</th>
            <th scope="col">{$i.useroptions_email_imap_mailbox_out}</th>
            <th scope="col"></th>
        </tr>
    </thead>
    <tbody>
        {foreach from=$user_options_email_list item=user_options_email name="index"}
            <tr class="{if $smarty.foreach.index.iteration is even}even{/if}">
                <th rowspan="2">
                    {if isset($user_options_email->user_can_edit) && $user_options_email->user_can_edit}
                        <span onclick="user_options_email.open('{$user_options_email->id}');" class="dialog_make_btn16 edit smallbtns ui-corner-all" title="{$i.basic_edit} ({$user_options_email->id})"></span>
                        <span onclick="user_options_email.delete_email('{$user_options_email->id}');" class="dialog_make_btn16 delete smallbtns ui-corner-all" title="{$i.basic_delete} ({$user_options_email->id})"></span>
                    {/if}
                </th>
                {if $show_default_selection}
                <td rowspan="2" style="border-bottom: 2px solid #C5C5C5;">
                    <input name="email_accounts_default" id="email_accounts_default{$user_options_email->id}" type="radio"
                        value="{$user_options_email->id}" {if $user_options_email->default_account}checked="checked"{/if}
                         onclick="user_options_email.set_default('{$user_options_email->id}');" />
                </td>
                {/if}
                <td>{$user_options_email->email}</td>
                <td>{$user_options_email->smtp_host}</td>
                <td>{$user_options_email->smtp_user}</td>
                <td>
                    {assign var="namekey" value="useroptions_email_`$user_options_email->smtp_mode`"}
                    {if isset($i.$namekey)}
                        {$i.$namekey}
                    {else}
                        {$user_options_email->smtp_mode}
                    {/if}
                </td>
                <td>{$user_options_email->smtp_port}</td>
                <td></td>
                <td></td>
                <td>
                    {if (isset($user_options_email->user_can_edit) && $user_options_email->user_can_edit) || (isset($user_options_email->user_can_smtp) && $user_options_email->user_can_smtp)}
                        <span style="float:left;">SMTP</span>
                        {if $user_options_email->smtp_pass===false}
                            <span class="warningsmall warningsmaller ui-corner-all">
                                {$lang_key = "basic_`$user_options_email->smtp_pass_error`"}
                                {sprintf($i.$lang_key, $user_options_email->email)}
                            </span>
                        {else}
                            <span class="dialog_make_text_btn ui-corner-all" style="float:right;"
                                onclick="user_options_email.email_test('{$user_options_email->id}', 'outbox');"
                                id="useroptions_email_test_{$user_options_email->id}_outbox">
                                    <span class="dialog_make_btn16 help blue ui-corner-all"></span>{$i.useroptions_email_test}</span>
                            {if $user_debug_mode}
                                <span class="dialog_make_text_btn ui-corner-all user_debug_mode_item" style="float:right;" title="Send debug to support@untermstrich.com"
                                    onclick="user_options_email.email_test('{$user_options_email->id}', 'outbox_support');"
                                    id="useroptions_email_test_{$user_options_email->id}_outbox_support">
                                        <span class="dialog_make_btn16 help blue ui-corner-all" style="width: 10px; height: 10px; background-size: 10px;"></span>D</span>
                            {/if}
                        {/if}
                    {/if}    
                </td>
            </tr>
            <tr class="{if $smarty.foreach.index.iteration is even}even{/if}">
                <td style="border-bottom: 2px solid #C5C5C5;"></td>
                <td style="border-bottom: 2px solid #C5C5C5;">{$user_options_email->imap_host}</td>
                <td style="border-bottom: 2px solid #C5C5C5;">{$user_options_email->imap_user}</td>
                <td style="border-bottom: 2px solid #C5C5C5;">
                    {assign var="namekey" value="useroptions_email_`$user_options_email->imap_mode`"}
                    {if isset($i.$namekey)}
                        {$i.$namekey}
                    {else}
                        {$user_options_email->imap_mode}
                    {/if}
                </td>
                <td style="border-bottom: 2px solid #C5C5C5;">{$user_options_email->imap_port}</td>
                <td style="border-bottom: 2px solid #C5C5C5;">{$user_options_email->imap_mailbox}</td>
                <td style="border-bottom: 2px solid #C5C5C5;">{$user_options_email->imap_mailbox_out}</td>
                <td style="border-bottom: 2px solid #C5C5C5;">
                    {if (isset($user_options_email->user_can_edit) && $user_options_email->user_can_edit) || (isset($user_options_email->user_can_imap) && $user_options_email->user_can_imap)}
                        <span style="float:left;">IMAP</span>
                        {if $user_options_email->imap_pass===false}
                            <span class="warningsmall warningsmaller ui-corner-all">
                                {$lang_key = "basic_`$user_options_email->imap_pass_error`"}
                                {sprintf($i.$lang_key, $user_options_email->email)}
                            </span>
                        {else}
                            <span class="dialog_make_text_btn ui-corner-all" style="float:right;"
                                onclick="user_options_email.email_test('{$user_options_email->id}', 'inbox');"
                                id="useroptions_email_test_{$user_options_email->id}_inbox">
                                <span class="dialog_make_btn16 help blue ui-corner-all"></span>{$i.useroptions_email_test}</span>
                        {/if}    
                    {/if}    
                </td>
            </tr>
        {/foreach}
    </tbody>                
</table>
