options['logs']['enable_logs']) ){ echo '

'.__('Email logs is disabled').'

'.__('To store and view email logs, please enable email logs from GoSMTP').' '.__('settings').'.

'; return; } // Styles and Scripts wp_enqueue_style( 'gosmtp-admin' ); wp_enqueue_script( 'gosmtp-admin' ); $filter = gosmtp_optget('filter'); $start = gosmtp_optget('from'); $end = gosmtp_optget('to'); $search = gosmtp_optget('search'); $default = array( 'subject' => 'on', 'date_send' => 'on', 'action' => 'on' ); $columns = !empty( $gosmtp->options['logs']['log_columns'] ) ? maybe_unserialize($gosmtp->options['logs']['log_columns']) : array(); $columns = array_merge($default, $columns); ?>

'', 'from' => '', 'to' => '', 'source' => '', 'provider' => '', 'date_send' => '', 'action' => '', ); foreach($logs_th as $key => $col ){ if(!empty($columns) && array_key_exists($key,$columns)){ echo $col; } } ?> !empty($filter) && $filter != 'all' ? ($filter == 'success' ? 'sent' : 'failed') : '', 'interval' => array( 'start' => $start, 'end' => $end ), 'search' => $search, ); // Pagination $perpage = 10; $records_ct = (int) $logger->get_logs('count', '', $options)->records; $tpages = ceil($records_ct / $perpage); $offset = ($curpage - 1) * $perpage; $options['limit'] = $perpage; $options['offset'] = $offset; $args = array( 'base' => '%_%', 'format' => '?paged=%#%', 'total' => $tpages, 'current' => $curpage, 'show_all' => false, 'end_size' => 1, 'mid_size' => 2, 'prev_next' => true, 'type' => 'array', 'add_args' => false ); $pagination = null; $pages = paginate_links( $args ); if( is_array( $pages ) ){ $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); $pagination .= '
    '; foreach ( $pages as $page ) { $pagination .= ''; } $pagination .= '
'; } $mails = $logger->get_logs('records', 0, $options); if(!empty($mails)){ foreach($mails as $key => $mail){ $id = $mail->id; $tos = maybe_unserialize($mail->to); $to_list = []; if(is_array($tos)){ foreach($tos as $key => $to){ $to_list[] = $to[0]; } $to_list = implode(',',$to_list); }else{ $to_list = $tos; } $created_at = date("M d, Y", strtotime($mail->created_at)).' at '. date('h:i A', strtotime($mail->created_at)); $status = $mail->status == 'sent' ? __('Sent') : __('Failed'); $resend_retry = $mail->status == 'sent' ? __('Resend') : __('Retry'); $backup_text = !empty($mail->parent_id) ? __('(Backup)') : ''; $logs_td = array( 'subject' => '', 'from' => '', 'to' => '', 'source' => '', 'provider' => '', 'date_send' => '', 'action' => '' ); ?> $col ){ if(!empty($columns) && array_key_exists($key,$columns)){ echo $col; } } ?>
'.__('Subject').''.__('From').''.__('To').''.__('Source').''.__('Provider').''.__('Date Send').''.__('Actions').'
'. (!empty($mail->subject) ? esc_attr($mail->subject) : __('[No Subject]')) .' '.(!empty($mail->from) ? esc_html($mail->from) : __('NA')).''.esc_html($to_list).''.(!empty($mail->source) ? esc_html($mail->source) : __('NA')).''.(!empty($mail->provider) ? ucwords(esc_html($mail->provider)).' '.$backup_text : __('NA')).''.esc_html($created_at).'

: