HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wp-content/themes/ormedia/page-propman-mail.php
<?php
//Template Name: propman mail

$statement2 = "SELECT a.*,b.name_zh,b.name_en,b.admin_wp_id,c.name_zh as username FROM `keylab_property_propman` as a left join `keylab_property` as b on a.property_id = b.property_id left join keylab_users as c on a.user_id = c.user_id WHERE a.MPF_file = 'N;' and a.propman_day != '0000-00-00'";
$results2 = $wpdb->get_results($statement2);

foreach($results2 as $value){
    $args = [
        'subject' => "MPF上傳提醒",
        'html' => "",
        'to' => []
    ];
    $tempday = get_property_meta($value->property_id, 'mdf_day');

    $real_day = BetweenDays($value->propman_day, date("Y-m-d"));

    if(!empty($tempday) && $real_day = intval($tempday)){
        $build_name = $value->name_zh;
        
        $args['html'] = "<h3> <a href=\"https://keylab.cc/\">Keylab</a>物管人員MPF提醒 </h3>
                    <br /><p>大廈 $build_name 的 $value->username MPF文件 尚未提交</p>
                    <br /><p>請到 <a href=\"https://keylab.cc/\">Keylab</a> 中查看詳情!</p>
                    ";
        $temp_user_email = $wpdb->get_var($wpdb->prepare("select user_email from wp_users where ID = %d",$value->admin_wp_id));
        $args['to'] = [ $temp_user_email ];
        var_dump($args['to'],$real_day >= intval($tempday));

        send_mailjet_email($args);
    }
}

function BetweenDays($day1, $day2)
{
  $second1 = strtotime($day1);
  $second2 = strtotime($day2);

  return ($second2 - $second1) / 86400;
}