add_action('pmxe_after_export', 'wpae_after_export', 10, 2); function wpae_after_export( $export_id, $exportObj ) { $is_secure_import = PMXE_Plugin::getInstance()->getOption('secure'); if ( ! $is_secure_import) { $filepath = get_attached_file($exportObj->attch_id); } else { $filepath = wp_all_export_get_absolute_path($exportObj->options['filepath']); } if(@file_exists($filepath)) { $to = 'target@yourdomain.eg'; $subject = 'Automated Export File'; $message = 'Cron job complete... '."\r\n".'File attached'; $headers = 'From: Your Name ' . "\r\n"; $attachments = array($filepath); wp_mail( $to, $subject, $message, $headers, $attachments ); } }