LLMS_Meta_Box_Voucher_Export::send_email( $csv, $emails )
Description Description
Source Source
File: includes/admin/post-types/meta-boxes/class.llms.meta.box.voucher.export.php
public static function send_email( $csv, $emails ) { $subject = 'Your LifterLMS Voucher Export'; $message = 'Please find the attached voucher csv export for ' . $title . '.'; // create temp file $temp = tempnam( '/tmp', 'vouchers' ); // write csv $handle = fopen( $temp, 'w' ); fwrite( $handle, $csv ); // prepare filename $temp_data = stream_get_meta_data( $handle ); $temp_filename = $temp_data['uri']; $new_filename = substr_replace( $temp_filename, '', 13 ) . '.csv'; rename( $temp_filename, $new_filename ); // send email/s $mail = wp_mail( $emails, $subject, $message, '', $new_filename ); // and remove it fclose( $handle ); unlink( $new_filename ); return $mail; }
Expand full source code Collapse full source code View on GitHub