Skip to content

Instantly share code, notes, and snippets.

Last active June 28, 2021 03:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Send import log to mail after successful cron import- Import and Export Suite for WooCommerce by WebToffee
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));
$destination = key($files);
$email = '';//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