Example #1
0
 /**
  * Responsible for sending the actual email
  */
 public static function send_email($data_context, $address, $subject_tmpl_file, $message_tmpl_file, $attachment)
 {
     // Load the subject and message templates
     $message_tmpl = file_get_contents(dirname(dirname(dirname(__FILE__))) . '/email_templates/' . $message_tmpl_file);
     $subject_tmpl = file_get_contents(dirname(dirname(dirname(__FILE__))) . '/email_templates/' . $subject_tmpl_file);
     // Fill the templates
     $message_tmpl = EntityStringUtils::parse($message_tmpl, $data_context);
     $subject_tmpl = EntityStringUtils::parse($subject_tmpl, $data_context);
     LogUtils::shadow_log($data_context);
     LogUtils::shadow_log('Sending mail to ' . $address . ' with subject ' . $subject_tmpl);
     // Send the email
     wp_mail($address, $subject_tmpl, $message_tmpl, '', $attachment);
 }