Plugin Directory

Changeset 3331837


Ignore:
Timestamp:
07/22/2025 04:12:41 AM (8 months ago)
Author:
aditya.dugar
Message:

"Small Changes In main file"

Location:
stars-smtp-mailer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stars-smtp-mailer/tags/2.2.1/stars_smtp_mailer.php

    r3331342 r3331837  
    541541
    542542function starssmtpmailer_send_weekly_email_callback() {
    543     // Get admin email from user list
    544     $admin_users = get_users(array(
     543    global $wpdb;
     544
     545    // ✅ Check if there’s an active SMTP configuration
     546    $active_smtp = $wpdb->get_var("
     547        SELECT COUNT(*)
     548        FROM {$wpdb->prefix}stars_smtp_settings
     549        WHERE status = 1
     550    ");
     551
     552    if (!$active_smtp) {
     553        error_log('[StarsSMTPMailer] Skipped sending weekly email – no active SMTP account.');
     554        return;
     555    }
     556
     557    // ✅ Get admin email fallback
     558    $admin_users = get_users([
    545559        'role'    => 'administrator',
    546560        'number'  => 1,
    547561        'orderby' => 'ID',
    548562        'order'   => 'ASC',
    549         'fields'  => array('user_email'),
    550     ));
    551 
    552     $admin_email = !empty($admin_users) ? $admin_users[0]->user_email : '';
    553 
    554     // Fallback to site admin email
    555     if (empty($admin_email)) {
    556         $admin_email = get_option('admin_email');
    557     }
    558 
    559     $to = $admin_email;
    560     $subject = 'Your Weekly SMTP Mail Report';
    561     $headers = array('Content-Type: text/html; charset=UTF-8');
    562 
    563     $message = '<p>Hello,</p>';
     563        'fields'  => ['user_email'],
     564    ]);
     565
     566    $admin_email = !empty($admin_users) ? $admin_users[0]->user_email : get_option('admin_email');
     567
     568    $to       = $admin_email;
     569    $subject  = 'Your Weekly SMTP Mail Report';
     570    $headers  = ['Content-Type: text/html; charset=UTF-8'];
     571    $message  = '<p>Hello,</p>';
    564572    $message .= '<p>Here is your weekly SMTP mail report:</p>';
    565573    $message .= starssmtpm_generate_email_statistics_html();
  • stars-smtp-mailer/trunk/stars_smtp_mailer.php

    r3331342 r3331837  
    541541
    542542function starssmtpmailer_send_weekly_email_callback() {
    543     // Get admin email from user list
    544     $admin_users = get_users(array(
     543    global $wpdb;
     544
     545    // ✅ Check if there’s an active SMTP configuration
     546    $active_smtp = $wpdb->get_var("
     547        SELECT COUNT(*)
     548        FROM {$wpdb->prefix}stars_smtp_settings
     549        WHERE status = 1
     550    ");
     551
     552    if (!$active_smtp) {
     553        error_log('[StarsSMTPMailer] Skipped sending weekly email – no active SMTP account.');
     554        return;
     555    }
     556
     557    // ✅ Get admin email fallback
     558    $admin_users = get_users([
    545559        'role'    => 'administrator',
    546560        'number'  => 1,
    547561        'orderby' => 'ID',
    548562        'order'   => 'ASC',
    549         'fields'  => array('user_email'),
    550     ));
    551 
    552     $admin_email = !empty($admin_users) ? $admin_users[0]->user_email : '';
    553 
    554     // Fallback to site admin email
    555     if (empty($admin_email)) {
    556         $admin_email = get_option('admin_email');
    557     }
    558 
    559     $to = $admin_email;
    560     $subject = 'Your Weekly SMTP Mail Report';
    561     $headers = array('Content-Type: text/html; charset=UTF-8');
    562 
    563     $message = '<p>Hello,</p>';
     563        'fields'  => ['user_email'],
     564    ]);
     565
     566    $admin_email = !empty($admin_users) ? $admin_users[0]->user_email : get_option('admin_email');
     567
     568    $to       = $admin_email;
     569    $subject  = 'Your Weekly SMTP Mail Report';
     570    $headers  = ['Content-Type: text/html; charset=UTF-8'];
     571    $message  = '<p>Hello,</p>';
    564572    $message .= '<p>Here is your weekly SMTP mail report:</p>';
    565573    $message .= starssmtpm_generate_email_statistics_html();
Note: See TracChangeset for help on using the changeset viewer.