GetSaveLogFolder().$task_log.'_log.txt'; $attachments[] = $log_file_name; } else{ $attachments = array(); } foreach ($option['send_to'] as $send_to) { if(wp_mail( $send_to, $subject, $body,$headers,$attachments)===false) { if($log!==false) { $message=get_error_messages('wp_mail_failed'); $log->WriteLog($message,'error'); } } } return true; } public static function send_report_mail_ex($task_id,$log=false) { $task= new WPvivid_Backup_Task_2($task_id); $option=WPvivid_Setting::get_option('wpvivid_email_setting'); $option=apply_filters('wpvivid_get_mail_option_addon', $option); if(empty($option)) { return true; } if($option['email_enable'] == 0){ return true; } if(empty($option['send_to'])) { return true; } $status=$task->get_status(); if($status['str']!=='error'&&$option['always']==false) { return true; } $headers = array('Content-Type: text/html; charset=UTF-8'); //$subject = ''; //$subject = apply_filters('wpvivid_set_mail_subject', $subject, $task); $subject =self::set_mail_subject($task_id); //$body = ''; //$body = apply_filters('wpvivid_set_mail_body', $body, $task); $body = self::set_mail_body($task_id); $task_log=$task->task['options']['log_file_name']; if(isset($option['email_attach_log'])){ if($option['email_attach_log'] == '1'){ $attach_log = true; } else{ $attach_log = false; } } else{ $attach_log = true; } if($attach_log){ $wpvivid_log=new WPvivid_Log(); if($status['str']==='error') { $log_file_name= $wpvivid_log->GetSaveLogFolder().'error'.DIRECTORY_SEPARATOR.$task_log.'_log.txt'; } else { $log_file_name= $wpvivid_log->GetSaveLogFolder().$task_log.'_log.txt'; } $attachments[] = $log_file_name; } else{ $attachments = array(); } foreach ($option['send_to'] as $send_to) { if(wp_mail( $send_to, $subject, $body,$headers,$attachments)===false) { if($log!==false) { $message=get_error_messages('wp_mail_failed'); $log->WriteLog($message,'error'); } } } return true; } public static function set_mail_subject($task_id) { $task= new WPvivid_Backup_Task_2($task_id); $task_status=$task->get_status(); if($task_status['str']!=='error') { $status='Succeeded'; } else { $status='Failed'; } $offset=get_option('gmt_offset'); $localtime=gmdate('m-d-Y H:i:s', $task->get_start_time()+$offset*60*60); $header='[Backup '.$status.']'.$localtime.' - By WPvivid Backup Plugin'; return $header; } public static function set_mail_body($task_id) { $task= new WPvivid_Backup_Task_2($task_id); $task_status=$task->get_status(); if($task_status['str']!=='error') { $status='Succeeded'; } else { $status='Failed. '.$task_status['error']; } $type=$task->task['type']; if($type === 'Cron') { $type = 'Cron-Schedule'; } $offset=get_option('gmt_offset'); $start_time=gmdate("m-d-Y H:i:s",$task->get_start_time()+$offset*60*60); $end_time=gmdate("m-d-Y H:i:s",time()+$offset*60*60); $running_time=($task->get_end_time()-$task->get_start_time()).'s'; $remote_options= $task->task['options']['remote_options']; if($remote_options!==false) { $remote_option=array_shift($remote_options); $remote=apply_filters('wpvivid_storage_provider_tran', $remote_option['type']); } else { $remote='Localhost'; } $content=''; $backup_content=isset($task->task['options']['backup_files'])?$task->task['options']['backup_files']:''; if($backup_content==='files') { $content.='All Files (Exclude Database)'; } else if($backup_content==='files+db') { $content.='Entire Website'; } else if($backup_content==='db') { $content.='Database'; } else { $content='Upload'; } $body='

24/7 Support: Twitter

Or Email Us

Wordpress Backup Report

You received this email because you have enabled the email notification feature in WPvivid plugin. Backup Details:

*WPvivid Backup plugin is a Wordpress plugin that will help you back up your site to the leading cloud storage providers like Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, FTP and SFTP.

Plugin Page: https://wordpress.org/plugins/wpvivid-backuprestore/

We\'re here to help you do your thing.

Contact Us or Twitter

 

'; return $body; } public static function create_subject($task) { $status=$task['status']['str']; if($status=='completed') { $status='Succeeded'; } else { $status='Failed'; } $offset=get_option('gmt_offset'); $localtime=gmdate('m-d-Y H:i:s', $task['status']['start_time']+$offset*60*60); $header='[Backup '.$status.']'.$localtime.' - By WPvivid Backup Plugin'; return $header; } public static function create_body($task) { $status=$task['status']['str']; if($status=='completed') { $status='Succeeded'; } else { $status='Failed. '.$task['status']['error']; } $type=$task['type']; if($type === 'Cron') { $type = 'Cron-Schedule'; } $offset=get_option('gmt_offset'); $start_time=gmdate("m-d-Y H:i:s",$task['status']['start_time']+$offset*60*60); $end_time=gmdate("m-d-Y H:i:s",time()+$offset*60*60); $running_time=($task['status']['run_time']-$task['status']['start_time']).'s'; $remote_options= $task['options']['remote_options']; if($remote_options!==false) { $remote_option=array_shift($remote_options); $remote=apply_filters('wpvivid_storage_provider_tran', $remote_option['type']); } else { $remote='Localhost'; } $content=''; $backup_options=$task['options']['backup_options']; if($backup_options!==false) { if(isset($backup_options['backup'][WPVIVID_BACKUP_TYPE_DB])&&isset($backup_options['backup'][WPVIVID_BACKUP_TYPE_THEMES])) { $content.='Entire Website'; } else if(isset($backup_options['backup'][WPVIVID_BACKUP_TYPE_DB])) { $content.='Database'; } else if(isset($backup_options['backup'][WPVIVID_BACKUP_TYPE_THEMES])) { $content.='All Files (Exclude Database)'; } } else { $content='Upload'; } $body='

24/7 Support: Twitter

Or Email Us

Wordpress Backup Report

You received this email because you have enabled the email notification feature in WPvivid plugin. Backup Details:

*WPvivid Backup plugin is a Wordpress plugin that will help you back up your site to the leading cloud storage providers like Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, FTP and SFTP.

Plugin Page: https://wordpress.org/plugins/wpvivid-backuprestore/

We\'re here to help you do your thing.

Contact Us or Twitter

 

'; return $body; } public static function wpvivid_send_debug_info($user_email,$server_type,$host_provider,$comment) { $send_to = 'support@wpvivid.com'; $subject = 'Debug Information'; $body = '
User\'s email: '.$user_email.'.
'; $body .= '
Server type: '.$server_type.'.
'; $body .= '
Host provider: '.$host_provider.'.
'; $body .= '
Comment: '.$comment.'.
'; $headers = array('Content-Type: text/html; charset=UTF-8'); $files=WPvivid_error_log::get_error_log(); if (!class_exists('WPvivid_PclZip')) include_once WPVIVID_PLUGIN_DIR . '/includes/zip/class-wpvivid-pclzip.php'; $backup_path=WPvivid_Setting::get_backupdir(); $path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path.DIRECTORY_SEPARATOR.'wpvivid_debug.zip'; if(file_exists($path)) { @wp_delete_file( $path); } $archive = new WPvivid_PclZip($path); if(!empty($files)) { if(!$archive->add($files,WPVIVID_PCLZIP_OPT_REMOVE_ALL_PATH)) { echo esc_html($archive->errorInfo(true)).' retry.'; exit; } } global $wpvivid_plugin; $server_info=wp_json_encode($wpvivid_plugin->get_website_info()); $server_file_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path.DIRECTORY_SEPARATOR.'wpvivid_server_info.json'; if(file_exists($server_file_path)) { @wp_delete_file( $server_file_path); } $server_file = fopen($server_file_path, 'x'); fclose($server_file); file_put_contents($server_file_path,$server_info); if(!$archive->add($server_file_path,WPVIVID_PCLZIP_OPT_REMOVE_ALL_PATH)) { echo esc_html($archive->errorInfo(true)).' retry.'; exit; } @wp_delete_file( $server_file_path); $attachments[] = $path; if(wp_mail( $send_to, $subject, $body,$headers,$attachments)===false) { $ret['result']='failed'; $ret['error']=__('Unable to send email. Please check the configuration of email server.', 'wpvivid-backuprestore'); } else { $ret['result']='success'; } @wp_delete_file($path); return $ret; } }