Last active
June 28, 2021 03:44
-
-
Save webtoffee-git/5071e3740c0f502ccb5e8d346358b929 to your computer and use it in GitHub Desktop.
Send import log to mail after successful cron import- Import and Export Suite for WooCommerce by WebToffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wt_ier_scheduled_action_finished', 'wt_scheduled_action_finished', 10,1); | |
function wt_scheduled_action_finished($out){ | |
ini_set('max_execution_time', -1); | |
ini_set('memory_limit', -1); | |
$wt_log_path = WP_CONTENT_DIR . '/webtoffee_iew_log'; // wp content path - fixed WP violation | |
$files = glob("$wt_log_path/*.*"); | |
$files = array_combine($files, array_map('filectime', $files)); | |
arsort($files); | |
$destination = key($files); | |
$email = 'user@mail.com';//Input your email ID | |
$object= 'Products imported successfully!';//Specify the subject for email | |
$message = 'OK. Automatic import performed SUCCESSFULLY. : ' .date('l d/m/Y H:i:s', time() ). '';//Enter the message | |
$mail_attachment = array($destination); | |
$headers = ''; | |
wp_mail( $email, $object, $message,$headers,$mail_attachment ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment