コード例 #1
0
 public static function resendEmailFromLog($id)
 {
     $resendEmail = false;
     global $wpdb;
     $tableName = Cart66Common::getTableName('email_log');
     $sql = "SELECT * from {$tableName} where id = {$id}";
     $results = $wpdb->get_results($sql);
     if ($results) {
         foreach ($results as $r) {
             $resendEmail = Cart66Notifications::mail($r->to_email, $r->subject, $r->body, $r->headers);
             $email = new Cart66EmailLog();
             $email_data = array('from_email' => $r->from_email, 'from_name' => $r->from_name, 'to_email' => $r->to_email, 'to_name' => $r->to_name, 'head' => array('headers' => $r->headers), 'subject' => $r->subject, 'msg' => $r->body, 'attachments' => $r->attachments, 'order_id' => $r->order_id);
             if (!$resendEmail) {
                 if (Cart66Setting::getValue('log_resent_emails')) {
                     $email->saveEmailLog($email_data, $r->email_type, $r->copy, 'RESEND FAILED');
                 }
             } else {
                 if (Cart66Setting::getValue('log_resent_emails')) {
                     $email->saveEmailLog($email_data, $r->email_type, $r->copy, 'RESEND SUCCESSFUL');
                 }
             }
         }
     }
     return $resendEmail;
 }
コード例 #2
0
 public static function resendEmailFromLog()
 {
     $log_id = $_POST['id'];
     $resendEmail = Cart66EmailLog::resendEmailFromLog($log_id);
     if ($resendEmail) {
         $result[0] = 'Cart66Modal alert-message success';
         $result[1] = '<strong>Success</strong><br/>' . __('Email successfully resent', 'cart66') . ' <br />';
     } else {
         $result[0] = 'Cart66Modal alert-message alert-error';
         $result[1] = '<strong>Error</strong><br/>' . __('Email was not resent Successfully', 'cart66') . '<br>';
     }
     echo json_encode($result);
     die;
 }
 public function sendEmail($email_data)
 {
     $isSent = false;
     $isSent = $this->mail($email_data['to_email'], $email_data['subject'], $email_data['msg'], $email_data['head']['headers']);
     $log = new Cart66EmailLog();
     if (!$isSent) {
         Cart66Common::log("Mail not sent to: " . $email_data['to_email']);
         if (Cart66Setting::getValue('log_' . $email_data['log'])) {
             $log->saveEmailLog($email_data, $email_data['email_type'], 'ORIGINAL', 'FAILED');
         }
     } else {
         if (Cart66Setting::getValue('log_' . $email_data['log'])) {
             $log->saveEmailLog($email_data, $email_data['email_type'], 'ORIGINAL', 'SUCCESSFUL');
         }
     }
     $others = $email_data['copy_to'];
     if ($others) {
         $list = explode(',', $others);
         foreach ($list as $e) {
             $e = trim($e);
             $isSent = $this->mail($e, $email_data['subject'], $email_data['msg_cc'], $email_data['head']['headers']);
             if (!$isSent) {
                 Cart66Common::log("Mail not sent to: {$e}");
                 if (Cart66Setting::getValue('log_' . $email_data['log']) && Cart66Setting::getValue('log_cc_emails')) {
                     $log->saveEmailLog($email_data, $email_data['email_type'], 'COPY', 'FAILED');
                 }
             } else {
                 Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Also mailed to: {$e}");
                 if (Cart66Setting::getValue('log_' . $email_data['log']) && Cart66Setting::getValue('log_cc_emails')) {
                     $log->saveEmailLog($email_data, $email_data['email_type'], 'COPY', 'SUCCESSFUL');
                 }
             }
         }
     }
     return $isSent;
 }
コード例 #4
0
</label>
              </td>
            </tr>
            <tr valign="top">
              <th scope="row">
                <?php 
    submit_button();
    ?>
              </th>
              <td></td>
            </tr>
          </tbody>
        </table>
      </form>
      <?php 
    $email = new Cart66EmailLog();
    $emails = $email->getModels(null, 'order by send_date DESC LIMIT 200');
    if (count($emails) && Cart66Setting::getValue('enable_email_log') == 1) {
        ?>
        <h3><?php 
        _e('Email Activity', 'cart66');
        ?>
</h3>
        <table class="widefat Cart66HighlightTable" id="email_log_table">
        <thead>
          <tr>
            <th><?php 
        _e('ID', 'cart66');
        ?>
</th>
            <th><?php 
コード例 #5
0
</label>
              </td>
            </tr>
            <tr valign="top">
              <th scope="row">
                <?php 
    submit_button();
    ?>
              </th>
              <td></td>
            </tr>
          </tbody>
        </table>
      </form>
      <?php 
    $email = new Cart66EmailLog();
    $emails = $email->getModels(null, 'order by send_date DESC');
    if (count($emails) && Cart66Setting::getValue('enable_email_log') == 1) {
        ?>
        <h3><?php 
        _e('Email Activity', 'cart66');
        ?>
</h3>
        <table class="widefat Cart66HighlightTable" id="email_log_table">
        <thead>
          <tr>
            <th><?php 
        _e('ID', 'cart66');
        ?>
</th>
            <th><?php