public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/functions.php
/**
 * Send an email out using a template.
 *
 * @since 1.0.0
 *
 * @param object $unitParentData The parent data for a unit.
 * @param object $userDetails The details of the user who's done the completing.
 * @param string $targetEmail The email address of the recipient.
 * @param string $subjectTemplate The content of the subject template, before substitutions.
 * @param string $bodyTemplate The content of the email body template, before substitutions.
 */
Send an email out using a template.

@param object $unitParentData The parent data for a unit.
@param object $userDetails The details of the user who's done the completing.
@param string $targetEmail The email address of the recipient.
@param string $subjectTemplate The content of the subject template, before substitutions.
@param string $bodyTemplate The content of the email body template, before substitutions.
Send an email out using a template . @param object $unitParentData The parent data for a unit . @param object $userDetails The details of the user who ' s done the completing . @param string $targetEmail The email address of the recipient . @param string $subjectTemplate The content of the subject template before substitutions . @param string $bodyTemplate The content of the email body template before substitutions .
function WPCW_email_sendEmail( $unitParentData, $userDetails, $targetEmail, $subjectTemplate, $bodyTemplate ) {
	$tagList_Body = WPCW_email_getTagList( $bodyTemplate );
	$bodyTemplate = WPCW_email_replaceTags_generic( $unitParentData, $userDetails, $tagList_Body, $bodyTemplate );
	$tagList_Subject = WPCW_email_getTagList( $subjectTemplate );
	$subjectTemplate = WPCW_email_replaceTags_generic( $unitParentData, $userDetails, $tagList_Subject, $subjectTemplate );
	$bodyTemplate    = html_entity_decode( $bodyTemplate, ENT_QUOTES, get_bloginfo( 'charset' ) );
	$subjectTemplate = html_entity_decode( $subjectTemplate, ENT_QUOTES, get_bloginfo( 'charset' ) );
	$headers = array( 'Content-Type: text/html; charset=UTF-8' );
	if ( $unitParentData->course_from_email ) {
		$headers[] = sprintf( 'From: %s <%s>' . "\r\n", $unitParentData->course_from_name, $unitParentData->course_from_email );
	}
	$bodyTemplate = wpautop( wp_kses_post( wptexturize( $bodyTemplate ) ) );
	if ( ! wp_mail( $targetEmail, $subjectTemplate, $bodyTemplate, $headers ) ) {
		error_log( 'WPCW_email_sendEmail() - email did not send.' );
	}
}
function WPCW_email_sendEmail ( $ unitParentData , $ userDetails , $ targetEmail , $ subjectTemplate , $ bodyTemplate ) { $ tagList_Body = WPCW_email_getTagList ( $ bodyTemplate ) ; $ bodyTemplate = WPCW_email_replaceTags_generic ( $ unitParentData , $ userDetails , $ tagList_Body , $ bodyTemplate ) ; $ tagList_Subject = WPCW_email_getTagList ( $ subjectTemplate ) ; $ subjectTemplate = WPCW_email_replaceTags_generic ( $ unitParentData , $ userDetails , $ tagList_Subject , $ subjectTemplate ) ; $ bodyTemplate = html_entity_decode ( $ bodyTemplate , ENT_QUOTES , get_bloginfo ( 'charset' ) ) ; $ subjectTemplate = html_entity_decode ( $ subjectTemplate , ENT_QUOTES , get_bloginfo ( 'charset' ) ) ; $ headers = array ( 'Content-Type: text/html; charset=UTF-8' ) ; if ( $ unitParentData -> course_from_email ) { $ headers [ ] = sprintf ( 'From: %s <%s>' . " \r \n " , $ unitParentData -> course_from_name , $ unitParentData -> course_from_email ) ; } $ bodyTemplate = wpautop ( wp_kses_post ( wptexturize ( $ bodyTemplate ) ) ) ; if ( ! wp_mail ( $ targetEmail , $ subjectTemplate , $ bodyTemplate , $ headers ) ) { error_log ( 'WPCW_email_sendEmail() - email did not send.' ) ; } }
Send an email out using a template.
Send an email out using a template .
// Replace content in email body first // Then do subject line // Encode. // Html. // Construct the from part of the email // Autop. // Actually send the email