forked from LiveCarta/LiveCartaWP
Changed source root directory
This commit is contained in:
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
|
||||
if ( ! class_exists( 'PostmanEmailReportSending' ) ) :
|
||||
|
||||
class PostmanEmailReportSending {
|
||||
|
||||
/**
|
||||
* Variable for the instance
|
||||
*
|
||||
* @var mixed
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
private static $_instance;
|
||||
|
||||
/**
|
||||
* Get the instance of the class
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public static function get_instance() {
|
||||
|
||||
if ( self::$_instance == null ) {
|
||||
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* PostmanEmailReportTemplate constructor.
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'schedule_email_reporting' ) );
|
||||
add_action( 'postman_rat_email_report', array( $this, 'handle_email_reporting' ) );
|
||||
add_filter( 'cron_schedules', array( $this, 'add_monthly_schedule' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Schedules the email reporting cron event based on user-defined settings.
|
||||
*
|
||||
* This function retrieves the reporting interval from plugin options and schedules
|
||||
* a WordPress cron job accordingly. If a schedule already exists and its interval
|
||||
* is different from the new one, the existing schedule is unscheduled and a new
|
||||
* schedule is created.
|
||||
* @since 3.0.1
|
||||
* @version 3.0.1
|
||||
*/
|
||||
public function schedule_email_reporting() {
|
||||
$options = get_option( 'postman_rat', array() );
|
||||
if ( isset( $options['enable_email_reporting'] ) && $options['enable_email_reporting'] ) {
|
||||
$schedules = array(
|
||||
'd' => 'daily',
|
||||
'w' => 'weekly',
|
||||
'm' => 'monthly',
|
||||
);
|
||||
|
||||
if ( isset( $options['reporting_interval'] ) && isset( $schedules[ $options['reporting_interval'] ] ) ) {
|
||||
$schedule = $schedules[ $options['reporting_interval'] ];
|
||||
|
||||
if ( ! wp_next_scheduled( 'postman_rat_email_report' ) ) {
|
||||
wp_schedule_event( current_time( 'timestamp' ), $schedule, 'postman_rat_email_report' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the email reporting functionality triggered by the cron job.
|
||||
*
|
||||
* This function checks if email reporting is enabled and retrieves the configured
|
||||
* reporting interval. If both conditions are met, it triggers the email-sending
|
||||
* functionality.
|
||||
* @since 3.0.1
|
||||
* @version 3.0.1
|
||||
*/
|
||||
public function handle_email_reporting() {
|
||||
$options = get_option( 'postman_rat' );
|
||||
$enabled = isset( $options['enable_email_reporting'] ) ? $options['enable_email_reporting'] : false;
|
||||
$interval = isset( $options['reporting_interval'] ) ? $options['reporting_interval'] : false;
|
||||
|
||||
if ( $enabled && $interval ) {
|
||||
$report_sent = $this->send_mail( $interval );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a custom monthly schedule to WordPress's cron system.
|
||||
*
|
||||
* @param array $schedules The existing cron schedules.
|
||||
* @return array Modified array of cron schedules with 'monthly' added.
|
||||
* @since 3.0.1
|
||||
* @version 3.0.1
|
||||
*/
|
||||
public function add_monthly_schedule( $schedules ) {
|
||||
// Check if textdomain is loaded to avoid early translation loading
|
||||
$display_text = 'Once Monthly';
|
||||
|
||||
if ( did_action( 'init' ) && function_exists( 'is_textdomain_loaded' ) && is_textdomain_loaded( 'post-smtp' ) ) {
|
||||
$display_text = __( 'Once Monthly', 'post-smtp' );
|
||||
}
|
||||
|
||||
$schedules['monthly'] = array(
|
||||
'interval' => 30 * DAY_IN_SECONDS,
|
||||
'display' => $display_text,
|
||||
);
|
||||
|
||||
return $schedules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get total email count
|
||||
*
|
||||
* @param int $from From Time Start.
|
||||
* @param int $to To time end.
|
||||
* @param int $limit Number of rows.
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function get_total_logs( $from = '', $to = '', $limit = '' ) {
|
||||
|
||||
if ( ! class_exists( 'PostmanEmailQueryLog' ) ) {
|
||||
|
||||
include_once POST_SMTP_PATH . '/Postman/Postman-Email-Log/PostmanEmailQueryLog.php';
|
||||
}
|
||||
$ps_query = new PostmanEmailQueryLog();
|
||||
|
||||
$where = ( ! empty( $from ) && ! empty( $to ) ) ? " WHERE pl.time >= {$from} && pl.time <= {$to}" : '';
|
||||
|
||||
|
||||
$query = "SELECT pl.original_subject AS subject, COUNT( pl.original_subject ) AS total,
|
||||
SUM( pl.success = 1 OR pl.success = 'Sent ( ** Fallback ** )' OR pl.success LIKE '( ** Fallback ** )%' ) As sent,
|
||||
SUM( pl.success != 1 AND pl.success != 'Sent ( ** Fallback ** )' AND pl.success NOT LIKE '( ** Fallback ** )%' ) As failed
|
||||
FROM {$ps_query->table} AS pl";
|
||||
|
||||
/**
|
||||
* Filter to get query from extension
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
$query = apply_filters( 'postman_health_count', $query );
|
||||
|
||||
$query .= "{$where} GROUP BY pl.original_subject";
|
||||
$query .= ! empty( $limit ) ? " LIMIT {$limit}" : '';
|
||||
|
||||
global $wpdb;
|
||||
$response = $wpdb->get_results( $query );
|
||||
|
||||
return $response ? $response : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the email body
|
||||
*
|
||||
* @param string $interval Time interval.
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function get_body( $interval ) {
|
||||
|
||||
$yesterday = new DateTime( 'yesterday' );
|
||||
$yesterday->setTime( 23, 59, 0 );
|
||||
$to = strtotime( $yesterday->format( 'Y-m-d H:i:s' ) );
|
||||
$from = '';
|
||||
$current_time = current_time( 'timestamp' );
|
||||
$duration = '';
|
||||
|
||||
if ( $interval === 'd' ) {
|
||||
$from = strtotime( 'today', $current_time );
|
||||
}
|
||||
if ( $interval === 'w' ) {
|
||||
$today = strtotime( 'today', $current_time );
|
||||
$from = strtotime( '-7 days', $today );
|
||||
}
|
||||
if ( $interval === 'm' ) {
|
||||
$today = strtotime( 'today', $current_time );
|
||||
$from = strtotime( '-1 month', $today );
|
||||
}
|
||||
|
||||
$logs = $this->get_total_logs( $from, $current_time );
|
||||
|
||||
include_once POST_SMTP_PATH . '/Postman/Postman-Email-Health-Report/PostmanReportTemplate.php';
|
||||
$get_body = new PostmanReportTemplate();
|
||||
$body = $get_body->reporting_template( $duration, $from, $to, $logs );
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to send the report
|
||||
*
|
||||
* @param string $interval Time Interval.
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function send_mail( $interval ) {
|
||||
|
||||
$duration = '';
|
||||
|
||||
if ( $interval === 'd' ) {
|
||||
|
||||
$duration = 'Daily';
|
||||
}
|
||||
if ( $interval === 'm' ) {
|
||||
|
||||
$duration = 'Monthly';
|
||||
}
|
||||
if ( $interval === 'w' ) {
|
||||
|
||||
$duration = 'Weekly';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the site title to be used in the email subject.
|
||||
*
|
||||
* @param string $site_title The site title.
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
$site_title = apply_filters( 'postman_rat_reporting_email_site_title', get_bloginfo( 'name' ) );
|
||||
|
||||
/**
|
||||
* Filters the email address to which the report is sent.
|
||||
*
|
||||
* @param string $to The email address to which the report is sent.
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
$to = apply_filters( 'postman_rat_reporting_email_to', get_option( 'admin_email' ) );
|
||||
|
||||
$subject = "Your {$duration} Post SMTP Report for {$site_title}";
|
||||
$body = $this->get_body( $interval );
|
||||
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
|
||||
|
||||
return wp_mail( $to, $subject, $body, $headers );
|
||||
}
|
||||
}
|
||||
|
||||
PostmanEmailReportSending::get_instance();
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
if ( ! class_exists( 'PostmanEmailHealthReporting' ) ) :
|
||||
class PostmanEmailHealthReporting {
|
||||
|
||||
/**
|
||||
* Instance of the class
|
||||
*
|
||||
* @var mixed
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Get the instance of the class
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public static function get_instance() {
|
||||
|
||||
if ( null == self::$instance ) {
|
||||
|
||||
self::$instance = new self;
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
add_filter( 'post_smtp_admin_tabs', array( $this, 'add_tab' ), 11 );
|
||||
add_action( 'post_smtp_settings_menu', array( $this, 'section' ) );
|
||||
add_filter( 'post_smtp_sanitize', array( $this, 'sanitize' ), 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add tab to Post SMTP Admin | Filter Callback
|
||||
*
|
||||
* @param array $tabs Tabs name.
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function add_tab( $tabs ) {
|
||||
|
||||
$tabs['email_reporting'] = sprintf( '<span class="dashicons dashicons-media-document"></span> %s', __( 'Email Reporting', 'post-smtp' ) );
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize the Settings | Filter Callback
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function sanitize( $input, $option, $section ) {
|
||||
|
||||
$data = array();
|
||||
|
||||
if ( isset( $_POST['_EmailReportingNounce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_EmailReportingNounce'] ) ), '_Reporting' ) ) {
|
||||
|
||||
// Do not save the settings if it's not saving from settings page.
|
||||
if ( isset( $_POST['action'] ) && $_POST['action'] !== 'ps-save-wizard' ) {
|
||||
|
||||
$data['enable_email_reporting'] = isset( $_POST['enable_email_reporting'] ) ? 1 : 0;
|
||||
$data['reporting_interval'] = isset( $_POST['reporting_interval'] ) ? sanitize_text_field( wp_unslash( $_POST['reporting_interval'] ) ) : 'w';
|
||||
|
||||
update_option( 'postman_rat', $data );
|
||||
}
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Section to Display Fields | Actoin Callback
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function section() {
|
||||
|
||||
$data = get_option( 'postman_rat' );
|
||||
|
||||
$checked = ( isset( $data['enable_email_reporting'] ) && $data['enable_email_reporting'] === 1 ) ? 'checked' : '';
|
||||
$selected_interval = ( isset( $data['reporting_interval'] ) ) ? $data['reporting_interval'] : 'w';
|
||||
$selection = array(
|
||||
'd' => __( 'Daily', 'post-smtp' ),
|
||||
'w' => __( 'Weekly', 'post-smtp' ),
|
||||
'm' => __( 'Monthly', 'post-smtp' ),
|
||||
);
|
||||
?>
|
||||
<section id="email_reporting">
|
||||
<h2><?php ( class_exists( 'Post_SMTP_Report_And_Tracking' ) ) ? esc_attr_e( 'Email Health Reporting', 'psrat' ) : esc_attr_e( 'Email Health Reporting Lite', 'psrat' ); ?></h2>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td><?php ( class_exists( 'Post_SMTP_Report_And_Tracking' ) ) ? esc_attr_e( 'Enable Email Reporting', 'psrat' ) : esc_attr_e( 'Enable Lite Email Reporting', 'psrat' ); ?></td>
|
||||
<td>
|
||||
<label class="ps-switch-1">
|
||||
<input type="checkbox" name="enable_email_reporting" <?php echo esc_attr( $checked ); ?> />
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_attr_e( 'Reporting Interval', 'psrat' ); ?></td>
|
||||
<td>
|
||||
<select name="reporting_interval">
|
||||
<?php
|
||||
foreach ( $selection as $key => $value ) {
|
||||
|
||||
$selected = ( $selected_interval == $key ) ? 'selected' : $selected_interval;
|
||||
|
||||
echo '<option value="' . esc_attr( $key ) . '" ' . esc_attr( $selected ) . '>' . esc_attr__( $value , 'psrat' ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<?php esc_attr_e( 'Get a detailed report of your emails, including the number of emails sent, the number of emails opened, the number of emails failed, on interval bases.', 'psrat' ); ?>
|
||||
</p>
|
||||
</section>
|
||||
<?php
|
||||
wp_nonce_field( '_Reporting', '_EmailReportingNounce' );
|
||||
}
|
||||
}
|
||||
PostmanEmailHealthReporting::get_instance();
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
|
||||
if ( ! class_exists( 'PostmanReportTemplate' ) ) :
|
||||
|
||||
class PostmanReportTemplate {
|
||||
|
||||
/**
|
||||
* Template of the email
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public function reporting_template( $duration, $from, $to, $logs ) {
|
||||
|
||||
$is_addonactivated = false;
|
||||
if ( class_exists( 'Post_SMTP_Report_And_Tracking' ) ) {
|
||||
$is_addonactivated = true;
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
$sent = 0;
|
||||
$failed = 0;
|
||||
$opened = 0;
|
||||
|
||||
// lets calculate the total.
|
||||
if ( $logs ) {
|
||||
|
||||
foreach ( $logs as $log ) {
|
||||
|
||||
if ( $log->total ) {
|
||||
$total += $log->total;
|
||||
}
|
||||
if ( $log->sent ) {
|
||||
$sent += $log->sent;
|
||||
}
|
||||
if ( $log->failed ) {
|
||||
$failed += $log->failed;
|
||||
}
|
||||
if ( $is_addonactivated && property_exists( $log, 'opened' ) ) {
|
||||
$opened += $log->opened;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the email address to which the report is sent.
|
||||
*
|
||||
* @param string $to The email address to which the report is sent.
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
$admin_email = apply_filters( 'postman_rat_reporting_email_to', get_option( 'admin_email' ) );
|
||||
$admin_name = '';
|
||||
$user = get_user_by( 'email', $admin_email );
|
||||
|
||||
if ( $user ) {
|
||||
|
||||
$admin_name = ! empty( $user->first_name ) ? $user->first_name : $user->user_login;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the site title to be used in the email subject.
|
||||
*
|
||||
* @param string $site_title The site title.
|
||||
* @since 2.9.0
|
||||
* @version 1.0.0
|
||||
*/
|
||||
$site_title = apply_filters( 'postman_rat_reporting_email_site_title', get_bloginfo( 'name' ) );
|
||||
$url = admin_url( "admin.php?page=post-smtp-email-reporting&from={$from}&to={$to}" );
|
||||
$extension_url = 'https://postmansmtp.com/pricing/?utm_source=wordpress&utm_medium=email&utm_campaign=email_report&utm_content=report_and_tracking';
|
||||
$disable_url = 'https://postmansmtp.com/pricing/?utm_source=wordpress&utm_medium=email&utm_campaign=email_report&utm_content=email_health_report/';
|
||||
|
||||
$body = '<div style=" width: 500px; margin: 0 auto; color: rgba(125, 152, 178, 1); font-size: 12px; font-family: Poppins, sans-serif;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding: 20px 0;text-align: center;">
|
||||
<a href="https://postmansmtp.com"><img src="'.POST_SMTP_ASSETS.'images/reporting/post_logo.png"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 20px;background: #F0F6FF;border-radius: 10px;">
|
||||
<h4 style=" margin: 0 0 5px 0;">Hi '.$admin_name.' </h4>
|
||||
<p style=" margin: 0 0 5px 0;">Here is a quick overview of how your emails were performing in the past '.$duration.'</p>
|
||||
<table style=" width: 100%; ">
|
||||
<tr>
|
||||
<td style=" width: 80px;">
|
||||
<div style="text-align: center; padding: 10px 10px; border-radius: 10px; background: #fff; color:#151D48; margin: 0 2px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/total.png" style="margin: 0 0 5px;width: 40px;height: 40px; "/>
|
||||
<h5 style="margin:0;font-weight: 400;font-size: 10px;">Total Emails<br> <strong style="font-size: 20px; font-weight: 600;">'.$total.'</strong></h5>
|
||||
</div>
|
||||
</td>
|
||||
<td style=" width: 80px;">
|
||||
<div style=" text-align: center; padding: 10px 10px; border-radius: 10px; background: #fff; color:#151D48; margin: 0 2px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/sent.png" style="margin: 0 0 5px;width: 40px;height: 40px;"/>
|
||||
<h5 style="margin:0;font-weight: 400;font-size: 10px;">Sent<br> <strong style="font-size: 20px; font-weight: 600;">'.$sent.'</strong></h5>
|
||||
</div>
|
||||
</td>
|
||||
<td style=" width: 80px;">
|
||||
<div style=" text-align: center; padding: 10px 10px; border-radius: 10px; background: #fff; color:#151D48; margin: 0 2px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/failed.png" style="margin: 0 0 5px;width: 40px;height: 40px;"/>
|
||||
<h5 style="margin:0;font-weight: 400;font-size: 10px;">Failed <br> <strong style="font-size: 20px; font-weight: 600;">'.$failed.'</strong></h5>
|
||||
</div>
|
||||
</td>
|
||||
<td style=" width: 80px;">
|
||||
'.($is_addonactivated ? '
|
||||
<div style=" text-align: center; padding: 10px 10px; border-radius: 10px; background: #fff; color:#151D48; margin: 0 2px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/opened.png" style="margin: 0 0 5px;width: 40px;height: 40px;"/>
|
||||
<h5 style="margin:0;font-weight: 400;font-size: 10px;">Opened<br><strong style="font-size: 20px; font-weight: 600;">'.$opened.'</strong></h5>
|
||||
</div>
|
||||
' : '
|
||||
<a href="'.$extension_url.'" style="text-decoration: none;">
|
||||
<div style="text-align: center; padding: 10px 10px; border-radius: 10px; background: #fbbc1f; color:#fff; margin: 0 2px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/opend.png" style="margin: 0 0 5px;width: 40px;height: 40px;"/>
|
||||
<h5 style="margin:0;font-weight: 400;font-size: 10px;">Opened<br>
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/lock.png" style="margin: 5px 0 0 0;"/>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
').'
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
'.($is_addonactivated ? '
|
||||
|
||||
<tr>
|
||||
<td colspan="4" style=" text-align: center;">
|
||||
<a href="'.$url.'" style=" display: inline-block; background: #375CAF; margin: 20px 0 0; color: #fff; text-decoration: none; padding: 12px 25px; border-radius: 100px;">View More Stats</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
' : '' ).'
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<!---->';
|
||||
|
||||
if(! post_smtp_has_pro()) {
|
||||
$body .= '<tr>
|
||||
<td>
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td style="width: 60%;">
|
||||
<div>
|
||||
<h3 style="color:rgba(33,74,114,1);font-size: 14px;">Unlock the Post SMTP Pro and enhance your email deliverability</h3>
|
||||
<ul style="margin: 0; padding: 0; list-style: none;">
|
||||
<li style="margin-bottom: 10px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/list-icon.png" alt="check" style="width: 14px;margin-bottom: -2px;">
|
||||
More Pro Mailers
|
||||
<img style="margin-bottom: -5px;" src="'.POST_SMTP_ASSETS.'images/reporting/mailers.png" alt="mailers.png">
|
||||
</li>
|
||||
<li style="margin-bottom: 10px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/list-icon.png" alt="check" style="width: 14px;margin-bottom: -2px;">
|
||||
All mobile app premium features.
|
||||
</li>
|
||||
<li style="margin-bottom: 10px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/list-icon.png" alt="check" style="width: 14px;margin-bottom: -2px;">
|
||||
Auto-resend failed emails.
|
||||
</li>
|
||||
<li style="margin-bottom: 10px;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/list-icon.png" alt="check" style="width: 14px;margin-bottom: -2px;">
|
||||
SMS Failure Notification.
|
||||
</li>
|
||||
</ul>
|
||||
<a href="'.$extension_url.'" style="border: 1px solid rgba(58, 94, 175, 1); color: rgba(58, 94, 175, 1); background: rgba(240, 246, 255, 1); text-decoration: none; padding: 12px 30px; margin: 15px 0; display:inline-block; border-radius: 100px;">Learn more about PRO <img src="'.POST_SMTP_ASSETS.'images/reporting/btn-arrow.png" style="margin: 0 0 0 5px;"/>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td style="width: 40%; text-align: center;">
|
||||
<div>
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/email-fav.png" alt="email-fav.png">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<!---->';
|
||||
}
|
||||
|
||||
if(!empty($logs)) {
|
||||
$logs_html = '';
|
||||
$logs_html .= '<!-- loop-->';
|
||||
$row = 1;
|
||||
foreach ( $logs as $log ) {
|
||||
// Let break if greater than 3.
|
||||
if ( $row > 3 ) {
|
||||
break;
|
||||
} else {
|
||||
$logs_html .= '
|
||||
<tr style="background: #F0F6FF;">
|
||||
<td style="padding:10px;color:#444a6d;font-size: 12px;font-weight:400;text-align: left;">'.$log->subject.'</td>
|
||||
<td style="padding: 10px;"></td>
|
||||
<td style="padding: 10px;"></td>
|
||||
<td style="padding: 10px;"></td>
|
||||
<td style="padding: 10px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td style="padding: 10px; text-align: center;">'.( isset( $log->total ) ? $log->total : '' ).'</td>
|
||||
<td style="padding: 10px; text-align: center;">'.( isset( $log->sent ) ? $log->sent : '' ).'</td>
|
||||
<td style="padding: 10px; text-align: center;">'.( isset( $log->failed ) ? $log->failed : '' ).'</td>
|
||||
<td style="padding: 10px; text-align: center;">'.( isset( $log->opened ) ? $log->opened : '' ).'</td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
$row ++;
|
||||
}
|
||||
$logs_html .= '<!-- end loop-->';
|
||||
}
|
||||
|
||||
if(empty($log)) {
|
||||
$logs_html = '';
|
||||
$logs_html .= '<tr><td colspan="5">No emails were sent last '.$duration.'</td></tr>';
|
||||
}
|
||||
|
||||
if($is_addonactivated && ! empty($logs)) {
|
||||
$body .= '<tr>
|
||||
<td style=" text-align: center;">
|
||||
<h4 style="text-align:center;color:#214A72;font-size:16px;display: inline-block;">
|
||||
<img src="'.POST_SMTP_ASSETS.'images/reporting/dashicons-clock.png" alt="dashicons-clock" style="vertical-align:middle;width: 20px;margin: -4px 0 0 0;"> Last '.$duration.' Top Emails
|
||||
</h4>
|
||||
<table style="width: 100%; border-spacing: 0;">
|
||||
<tr>
|
||||
<td style="width: 50%; color: #151D48; font-size: 14px; font-weight: 600; padding: 10px 0 15px;">
|
||||
Subject
|
||||
</td>
|
||||
<td style="color: #83F5AF; width: 12%;text-align: center; padding: 10px 0 15px;">
|
||||
Total
|
||||
</td>
|
||||
<td style="color: #98B9F9; width: 12%;text-align: center; padding: 10px 0 15px;">
|
||||
Sent
|
||||
</td>
|
||||
<td style="color: #FF955F; width: 12%;text-align: center; padding: 10px 0 15px;">
|
||||
Failed
|
||||
</td>
|
||||
<td style="color: #FFAE3A; width: 12%;text-align: center; padding: 10px 0 15px;">
|
||||
Opened
|
||||
</td>
|
||||
</tr>
|
||||
'.$logs_html.'
|
||||
</table>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$body .='
|
||||
<!---->
|
||||
<tr>
|
||||
<td style="text-align: center;padding: 20px 0;">This email was auto-generated and learn how to <a href="'.$disable_url.'"><strong>disable it</strong></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
return $body;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif;
|
||||
Reference in New Issue
Block a user