<?

// FIX IT


logger3("got to email_receipts.shared",$x);
####################################################################################
####################################################################################
####################################################################################

######################################################
################ admin_identity_claim_rejected #######
######################################################


if($email_receipt == "admin_identity_claim_rejected") {

	/*
	$dear_who
	$send_to
	$member_password
	$member_emailaddress
	$account_type
	$account_type
	*/
	
	if(!empty($email_to)) $send_to = $email_to; $email_to = "";
	

	//$email_descriptive = strtoupper("(ALERT!)");
	

	
	$email_subject = "alert: ".$email_firstname_lastname." (re: Problem w/ Identity Verification)";
	//$dear_who = $email_firstname_lastname;
	$text_insert = "(what's up text space!?)";
	if($account_type == "PERSONAL" && $claim_type == "IDENTITY") $claim_type = "PHOTO ID";
	



	$html_insert = "<br>";
	$html_insert .= "Your proposed ";
	$html_insert .= "<span style='font-size:120%;'>";
	$html_insert .= "<b><u>Proof of ".$account_type." ".$claim_type."</u></b>";
	$html_insert .= "</span>";
	$html_insert .= " that you have provided:";
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	
	
	
	//test("_SESSION['admin']['identity_claim_details']",$_SESSION['admin']['identity_claim_details']);
	/// PERSONAL IDENTITY
	if(!empty($_SESSION['admin']['identity_claim_details']['photo_id_filename'])) {
		$html_insert .= "<a href='https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['identity_claim_details']['photo_id_filename'] ."'>";
		$html_insert .= "https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['identity_claim_details']['photo_id_filename'] ."";
		$html_insert .= "</a>";
	}
	
	
	/// PERSONAL LOCATION
	if(!empty($_SESSION['admin']['identity_claim_details']['proof_of_residence_filename'])) {
		$html_insert .= "<a href='https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['identity_claim_details']['proof_of_residence_filename'] ."'>";
		$html_insert .= "https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['identity_claim_details']['proof_of_residence_filename'] ."";
		$html_insert .= "</a>";	
	}
	
	//// BUSINESS IDENTITY
	if(!empty($_SESSION['admin']['identity_claim_details']['business_certificate_filename'])) {
		$html_insert .= "<a href='https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['identity_claim_details']['business_certificate_filename'] ."'>";
		$html_insert .= "https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['identity_claim_details']['business_certificate_filename'] ."";
		$html_insert .= "</a>";	
		
	}

	//// BUSINESS LOCATION
	if(!empty($_SESSION['admin']['identity_claim_details']['proof_of_business_location_filename'])) {
		$html_insert .= "<a href='https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['identity_claim_details']['proof_of_business_location_filename'] ."'>";
		$html_insert .= "https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['identity_claim_details']['proof_of_business_location_filename'] ."";
		$html_insert .= "</a>";	
		
	}
	
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	//$html_insert .= "...is NOT a valid form of ID because it is missing the following information:";
	
	
	$html_insert .= "...has been REJECTED for the following reason:";
	
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	$html_insert .= "&nbsp;&nbsp;&nbsp;";
	$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
	$html_insert .= "&bull;";
	$html_insert .= "</span>";
	$html_insert .= "&nbsp;";

	if(stristr($return_type_details,"NOPHOTO")) {
		$html_insert .= "<b>\"NO PHOTO\"</b>";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "Please source/scan a government-issued PHOTO ID.  Then please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
	}


	if(stristr($return_type_details,"CORRUPT")) {
		$html_insert .= "<b>Technical Error: / \"Unable to Open File\"</b> ";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "Unfortunately, we are unable to OPEN the FILE you have provided.  PLEASE <u>RE-SCAN or RE-PHOTOGRAPH</u> your document. Once you have re-scanned your document, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
	}

	// test("return_type",$return_type);
	// test("return_type_details",$return_type_details);
	// exit;
	// 
	if(stristr($return_type_details,"ILLEGIBLE")) {
		$html_insert .= "<b>Illegible Document: \"Unable to read due to poor quality of document.\"</b> ";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "PLEASE <u>RE-SCAN or RE-PHOTOGRAPH</u> your document. Once you have re-scanned your document, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
	}

	if(stristr($return_type_details,"PROTECTED")) {
		$html_insert .= "<b>Unable to Open File: \"Password Protected\"</b> ";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "Unfortunately, we are unable to open and view the document due to password restrictions.  DO NOT send us the password.  PLEASE <u>RE-SCAN or RE-PHOTOGRAPH</u> your document. Once you have re-scanned your document, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
	}
	
	###############################################
	### IDENTITY/LOCATION: NOT-PRESENT
	###############################################
	if(stristr($return_type_details,"NOTPRESENT")) {
		$html_insert .= "<b>\"Invalid Document\"</b> ";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "The document you have provided is NOT a valid form of ID because it is missing the following information:";
		
		if(stristr($return_type_details,"FIRSTNAME")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "<b>Your FIRSTNAME (\"". $email_member_details['current']['identity']['firstname'] ."\") is NOT PRESENT.</b>";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "**NOTE: Your <u>FIRSTNAME and LASTNAME must be present</u> on the ID.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
		if(stristr($return_type_details,"LASTNAME")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "<b>Your LASTNAME (\"". $email_member_details['current']['identity']['lastname'] ."\") is NOT PRESENT.</b>";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "**NOTE: Your <u>FIRSTNAME and LASTNAME must be present</u> on the ID.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}	
		

		if(stristr($return_type_details,"CITIZENSHIP")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "<b>Your COUNTRY OF CITIZENSHIP (\"". $email_member_details['current']['identity']['citizenship_iso3'] ."\") is NOT PRESENT.</b>";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['citizenship_iso3'] ."\", which does NOT match the CITIZENSHIP on your ID.";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "**NOTE: Your <u>COUNTRY OF CITIZENSHIP must be present</u> on the ID.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
		
		if(stristr($return_type_details,"IDNUMBER")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "<b>Your ID NUMBER (\"". $email_member_details['current']['identity']['id_number'] ."\") is NOT PRESENT.</b>";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "**NOTE: Your <u>ID NUMBER must be present</u> on the ID.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}

		
		if(stristr($return_type_details,"NAMEATADDRESS")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "<b>Your PERSONAL NAME (\"". $email_member_details['current']['identity']['firstname'] ." ". $email_member_details['current']['identity']['lastname'] ."\") is NOT PRESENT.**</b>";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "**NOTE: Your PERSONAL NAME, (FIRST NAME and LAST NAME) must be present on the Proof of Residence document that you provide.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
		if(stristr($return_type_details,"RESIDENTIAL1")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "<b>Your RESIDENTIAL STREET ADDRESS (\"". $email_member_details['current']['location']['residential_address_1'] ."\") is NOT PRESENT.</b>";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "**NOTE: Your <u>RESIDENTIAL STREET ADDRESS must be present</u> on the Proof of Residence document that you provide.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
			

		/// business: identity
		if(stristr($return_type_details,"BUSINESSNAME")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "You provided \"". $email_account_details['accountname'] ." " . $email_account_details['business_type'] . "\", which is NOT PRESENT on the document(s) you provided. In the case of a registered company, the BUSINESS NAME (in its entirety) MUST BE VISIBLE on your submitted document(s).";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
		if(stristr($return_type_details,"BUSINESSID")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "The BUSINESS ID NUMBER that you have provided (\"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\") is NOT PRESENT on the document that you have provided.  Please submit a new set of documents, and make sure that the BUSINESS ID NUMBER is visible, for Proof of Business Identity.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
		
		if(stristr($return_type_details,"BUSINESSADDRESS")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "The BUSINESS STREET ADDRESS that you provided (\"". $_SESSION['admin']['identity_claim_details']['business_address_1'] ."\") is NOT PRESENT. (Your <u>BUSINESS STREET ADDRESS must be present</u> on the Proof of Business Location document that you provide.)";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
			
		
		$html_insert .= "<br>";
		//$html_insert .= "Please review our <a href='https://SUPPORT.".$_SESSION['template']['company']['domain']."'>https://SUPPORT.".$_SESSION['template']['company']['domain']."</a> for details about this issue.  After you have sourced/scanned a valid (set of) document(s), please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
		
		$html_insert .= "To correct this, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a> to your account. Then, SELECT ACCOUNT (to manage) --> ACCOUNT SETTINGS --> IDENTITY VERIFICATION --> then RESUBMIT your claims -- making sure the data you enter into the fields MATCHES EXACTLY the details printed on your document.";

	}


	###############################################
	### IDENTITY/LOCATION: MIS-MNATCH
	###############################################
	if(stristr($return_type_details,"MISMATCH")) {
		$html_insert .= "<b>\"Mis-Matched Data\"**</b> ";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		//$html_insert .= "The document that you have provided is acceptable, but the following data you provided does NOT match the details on your document.";
		$html_insert .= "**NOTE: The data that you provide must match - EXACTLY - the data as it appears on your submitted document (Proof of $account_type $claim_type).";

		
		if(stristr($return_type_details,"FIRSTNAME")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['firstname'] ."\", which does NOT match the FIRSTNAME on your ID.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
		if(stristr($return_type_details,"LASTNAME")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['lastname'] ."\", which does NOT match the LASTNAME on your ID.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}	

		if(stristr($return_type_details,"CITIZENSHIP")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['citizenship_iso3'] ."\", which does NOT match the CITIZENSHIP on your ID.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
		if(stristr($return_type_details,"IDNUMBER")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}	

		if(stristr($return_type_details,"NAMEATADDRESS")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "Your registered PERSONAL NAME (\"". $_SESSION['admin']['identity_claim_details']['firstname'] ." ". $_SESSION['admin']['identity_claim_details']['middlename'] ." ". $_SESSION['admin']['identity_claim_details']['lastname'] ."\") <u>DOES NOT match</u> (exactly and/or entirely) the PERSONAL NAME as it appears on the document you have provided.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}
		
		
		if(stristr($return_type_details,"RESIDENTIAL1")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "Your registered RESIDENTIAL STREET ADDRESS (\"". $_SESSION['admin']['identity_claim_details']['residential_address_1'] ." ". $_SESSION['admin']['identity_claim_details']['residenatial_address_2'] ." ". $_SESSION['admin']['identity_claim_details']['residenatial_address_3'] ."\") <u>DOES NOT match</u> (exactly and/or entirely) the RESIDENTIAL STREET ADDRESS as it appears on the document you have provided.)";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}		
		

		if(stristr($return_type_details,"BUSINESSNAME")) {
			//test("_SESSION['admin']['identity_claim_details']",$_SESSION['admin']['identity_claim_details']);
			
			
			if(!empty($_SESSION['admin']['identity_claim_details']['business_name'])) $parent_details['name'] = $_SESSION['admin']['identity_claim_details']['business_name'] ." " .  $_SESSION['admin']['identity_claim_details']['business_legal_extension'];
			
			//if(empty($parent_details['name'])) $parent_details = get_parent_details($_SESSION['admin']['identity_claim_details']['accountid']);
			
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "You provided \"". $email_account_details['accountname'] ." " . $email_account_details['business_type'] . "\", which does NOT EXACTLY MATCH the BUSINESS NAME on the document(s) you provided. In the case of a registered company, the BUSINESS NAME (in its entirety) MUST MATCH the business name on your submitted document(s).";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}	
		
		
		
		if(stristr($return_type_details,"BUSINESSID")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which <u>does NOT match</u> (exactly and/or entirely) the ID NUMBER on the document you provided.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}		
		

		if(stristr($return_type_details,"BUSINESSADDRESS")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			//$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['id_number'] ."\", which does NOT match the ID NUMBER on your ID.";
			$html_insert .= "You provided \"". $_SESSION['admin']['identity_claim_details']['business_address_1'] ."\", which <u>does NOT match</u> (exactly and/or entirely) the BUSINESS ADDRESS as it appears on the document you have provided.";
			$html_insert .= "</span>";
			$html_insert .= "<br>";
		}	
		
		
		
		
		
		//$html_insert .= "<br>";
		//$html_insert .= "Please review our <a href='https://SUPPORT.".$_SESSION['template']['company']['domain']."'>https://SUPPORT.".$_SESSION['template']['company']['domain']."</a> for details about this issue.  After you have sourced/scanned a valid set of documents, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";

		$html_insert .= "<br>";
		$html_insert .= "To correct this, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a> to your account. Then SELECT ACCOUNT (to manage) --> ACCOUNT SETTINGS --> IDENTITY VERIFICATION STATUS --> then RESUBMIT your claims -- making sure the data you enter into the fields <u>MATCHES EXACTLY</u> the details printed on your document.";
	}
	
	$html_insert .= "<br>";
	
	// test("return_type_details",$return_type_details);
	// test("html_insert",$html_insert);
	// exit;
	

	
	

}

######################################################
################ admin_identity_claim_verified #######
######################################################

if($email_receipt == "admin_identity_claim_verified") {

	/*
	$dear_who
	$send_to
	$member_password
	$member_emailaddress
	$account_type
	$claim_type
	*/
	

	//$email_descriptive = strtoupper("(ALERT!)");
	

	//$dear_who = $email_firstname_lastname;
	$email_subject = "update: ". $account_type ." ". $claim_type ." (Verified!)";
	$text_insert = "(what's up text space!?)";


	//$identity_name = $identity_name;


	$html_insert = "<br>";
	$html_insert .= "The proof of <u><b>". $account_type ." ". $claim_type ."</b></u> you have submitted <b>has been VERIFIED</b> as:";
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	$html_insert .= "&nbsp;&nbsp;&nbsp;";
	$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
	$html_insert .= "&bull;";
	$html_insert .= "&nbsp;";
	$html_insert .= $identity_name;
	$html_insert .= "</span>";
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	
	$html_insert .= "For more information about our identity verification process, and your legal Rights and Protections defined under YOU OWN YOU&trade; -- our open source legal framework, please review <a href='https://SUPPORT.".$_SESSION['template']['company']['domain']."'>https://SUPPORT.".$_SESSION['template']['company']['domain']."</a>, or <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a> to your account, then SELECT ACCOUNT (to manage) --> ACCOUNT SETTINGS --> IDENTITY VERIFICATION STATUS.";
	$html_insert .= "<br>";
	
	//test("html_insert",$html_insert);

	
	// test("return_type_details",$return_type_details);
	// test("html_insert",$html_insert);
	// exit;
	

	

}


#####################################################
################ admin_banking_claim_rejected #######
#####################################################


if($email_receipt == "admin_banking_claim_rejected") {

	/*
	$dear_who
	$send_to
	$member_password
	$member_emailaddress
	$account_type
	$account_type
	*/
	
	if(!empty($email_to)) $send_to = $email_to; $email_to = "";
	

	//$email_descriptive = strtoupper("(ALERT!)");
	

	
	$email_subject = "alert: ".pretty_member_name($_SESSION['admin']['banking_claim']['member_details']['memberid'])." (re: Problem w/ Banking Account Verification)";
	//$dear_who = $email_firstname_lastname;
	$text_insert = "(what's up text space!?)";
	//if($account_type == "PERSONAL" && $claim_type == "IDENTITY") $claim_type = "PHOTO ID";
	



	# $html_insert = "<br>";
	# $html_insert .= "Your proposed Proof of ".$account_type." ".$claim_type." has been REJECTED for the following reason:";
	# $html_insert .= "<br>";
	# $html_insert .= "&nbsp;&nbsp;&nbsp;";
	# $html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
	# $html_insert .= "&bull;";
	# $html_insert .= "</span>";
	# $html_insert .= "&nbsp;";

	// if(stristr($return_type,"NOPHOTO")) {
	// 	$html_insert .= "<b>\"NO PHOTO\"</b>";
	// 	$html_insert .= "<br>";
	// 	$html_insert .= "<br>";
	// 	$html_insert .= "Please source/scan a government-issued PHOTO ID.  Then please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$_SESSION['admin']['banking_claim']['member_details']['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
	// }

	$html_insert = "<br>";
	$html_insert .= "Your proposed Proof of <b>".$account_type." ".$claim_type."</b> that you have provided:";
	
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	

	$html_insert .= "<a href='https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['wallet_claim_details']['banking_statement_filename'] ."' target='". $_SESSION['admin']['wallet_claim_details']['banking_statement_filename'] ."'>";
	$html_insert .= "https://". $_SESSION['template']['company']['host_authorizations'] ."/ids/". $_SESSION['admin']['wallet_claim_details']['banking_statement_filename'];
	$html_insert .= "</a>";	
	
	
	
	
	
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	//$html_insert .= "...is NOT a valid form of ID because it is missing the following information:";
	
	
	$html_insert .= "...has been REJECTED for the following reason:";



	####################################################
	### ILLEGIBLE #######################################
	####################################################
	
	if(stristr($return_type,"ILLEGIBLE")) {
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
		$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
		$html_insert .= "<b>\"Illegible Document\"</b> ";
		$html_insert .= "</span>";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "PLEASE <u>RE-SCAN or RE-PHOTOGRAPH</u> your document. Once your have re-scanned your document, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$_SESSION['admin']['banking_claim']['member_details']['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
	}

	####################################################
	### INVALID #######################################
	####################################################
	
	if(stristr($return_type,"INVALID")) {
	
		if(
		(stristr($_GET['wallet_claim_status'],"LOCALROUTNINGNUMBER")) ||
		(stristr($_GET['wallet_claim_status'],"SWIFT"))
		) {
		 	$document_description = "Incomplete Documentation";
		} else {
			$document_description = "Invalid Document";
		}
	
	
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
		$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
		$html_insert .= "<b>\"". $document_description ."\"</b> ";
		$html_insert .= "</span>";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "noting:";
		
		
		
		
		
		if(stristr($_GET['wallet_claim_status'],"PERSONALNAME")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			
			$html_insert .= "Your PERSONAL NAME was not displayed on the banking document your provided.  As you are VERIFIED to be operating as \"". $_SESSION['admin']['withdrawal']['parent_details']['name'] ."\", <u>your PERSONAL NAME must be displayed on this proof this banking document</u>.";
			$html_insert .= "</span>";
			
		}

		### DBA/GROUP
		if(stristr($_GET['wallet_claim_status'],"NAMEONACCOUNT")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "One of the following MUST be present on your banking statement:";
			$html_insert .= "<ul><b>";
			$html_insert .= "<li> " . $_SESSION['admin']['banking_claim']['parent_details']['name'] . "</li>";
			$html_insert .= "<li> " . $_SESSION['admin']['banking_claim']['account_business_details']['accountname'] . "</li>";
			$html_insert .= "</b></ul>";
			$html_insert .= "One of the above identity/names MUST be present on the bank statement.  <u>If none of these are available</u>, please open a new banking account OR <u>update your BUSINESS IDENTITY</u> so that it matches the name on your existing banking statement.";
			$html_insert .= "</span>";
			
		}
		
		if(stristr($_GET['wallet_claim_status'],"BUSINESSNAME")) {
			
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "<b><u>Your BUSINESS NAME was not displayed on the banking document you provided</u>.</b>  As you are VERIFIED to be operating as \"". $_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_legal_extension'] ."\", <u>your REGISTERED and VERIFIED BUSINESS NAME must be displayed on this proof this banking document</u>.";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='color:#444444; font-weight:normal;'>";
			$html_insert .= "<span style='color:#EE0000;'>";
			$html_insert .= "note:";
			$html_insert .= "</span>";
			$html_insert .= "&nbsp;";
			$html_insert .= "IF YOU WANT TO USE <u>YOUR PERSONAL BANKING ACCOUNT</u>, you must EDIT/UPDATE your ". $_SESSION['template']['company']['name'] ." Account IDENTITY.  Please review our <a href='https://". $_SESSION['template']['company']['host_support'] ."' target='". $_SESSION['template']['company']['host_support'] ."'>https://". $_SESSION['template']['company']['host_support'] ."</a> for more information and details about this issue.";
			$html_insert .= "</span>";
			$html_insert .= "</span>";
			
		}
		
		if(stristr($_GET['wallet_claim_status'],"ACCOUNTNUMBER")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "<b>Your BANKING ACCOUNT NUMBER was not displayed on the banking document you provided.</b>";
			$html_insert .= "&nbsp;";
			$html_insert .= "<u>You must please provide a banking statement that clearly displays your BANKING ACCOUNT NUMBER</u>.";
			//$html_insert .= "<br>";
			//$html_insert .= "<br>";
			//$html_insert .= "<span style='color:#444444; font-weight:normal;'>";
			//$html_insert .= "<span style='color:#EE0000;'>";
			//$html_insert .= "note:";
			//$html_insert .= "</span>";
			//$html_insert .= "&nbsp;";
			//$html_insert .= "IF YOU WANT TO USE <u>YOUR PERSONAL BANKING ACCOUNT</u>, you must EDIT/UPDATE your ". $_SESSION['template']['company']['name'] ." Account IDENTITY.  Please review our <a href='https://". $_SESSION['template']['company']['host_support'] ."' target='". $_SESSION['template']['company']['host_support'] ."'>https://". $_SESSION['template']['company']['host_support'] ."</a> for more information and details about this issue.";
			//$html_insert .= "</span>";
			
			$html_insert .= "</span>";
			
		}
	
		if(stristr($_GET['wallet_claim_status'],"SWIFT")) {
			
			$email_reply_to_address = "accounting@".$_SESSION['template']['company']['domain'];
			$email_from_name = "acounting.".$_SESSION['template']['company']['name'];
			$final_status = "HOLD"; // KEEPS IT

			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "<b>Your SWIFT was not displayed on the banking document(s) you provided.</b>";
			
			$html_insert .= "&nbsp;";
			$html_insert .= "<span style='color:#EE0000;'>";
			$html_insert .= "<u>PLEASE REPLY TO THIS EMAIL</u>";
			
			$html_insert .= "&nbsp;";
			$html_insert .= "with the <u>CONFIRMED SWIFT NUMBER</u>";
			$html_insert .= "</span>";
			
			$html_insert .= "&nbsp;";
			$html_insert .= "for your specific banking branch!.";
			

			
		}
	
		if(stristr($_GET['wallet_claim_status'],"LOCALROUTNINGNUMBER")) {
			

			$email_reply_to_address = "accounting@".$_SESSION['template']['company']['domain'];
			$email_from_name = "acounting.".$_SESSION['template']['company']['name'];
			$final_status = "HOLD"; // KEEPS IT


			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "<b>Your LOCAL ROUTING NUMBER (ABA / BSB / IFSC) was not displayed on the banking document(s) you provided.</b>";
			$html_insert .= "&nbsp;";
			$html_insert .= "<span style='color:#EE0000;'>";
			$html_insert .= "<u>PLEASE REPLY TO THIS EMAIL</u>";
			
			$html_insert .= "&nbsp;";
			$html_insert .= "with the <u>CONFIRMED LOCAL ROUTING NUMBER (ABA / BSB / IFSC)</u>";
			$html_insert .= "</span>";
			
			$html_insert .= "&nbsp;";
			$html_insert .= "for your specific banking branch!.";
			$html_insert .= "</span>";
		}

	}
	
	
	####################################################
	### PASSWORD PROTECTED #############################
	####################################################
	
	if(stristr($_GET['wallet_claim_status'],"PROTECTED")) {
	
	    $html_insert .= "<br>";
	    $html_insert .= "<br>";
	    $html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
	    $html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
	    $html_insert .= "<b>\"Password Protected\"</b> ";
	    $html_insert .= "</span>";
	    $html_insert .= "<br>";
	    $html_insert .= "<br>";
	    $html_insert .= "The document you have provided is PASSWORD PROTECTED.  <u>Please resubmit this document w/o PASSWORD PROTECTION</u>.  Please review our <a href='https://SUPPORT.".$_SESSION['template']['company']['domain']."'>https://SUPPORT.".$_SESSION['template']['company']['domain']."</a> for details about this issue.  After you have sourced/scanned a valid set of documents, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$_SESSION['admin']['banking_claim']['member_details']['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
	}	

	####################################################
	### CORRUPT            #############################
	####################################################
	
	if(stristr($_GET['wallet_claim_status'],"CORRUPT")) {
	    $html_insert .= "<br>";
	    $html_insert .= "<br>";
	    $html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
	    $html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
	    $html_insert .= "<b>\"Unable to Open File\"</b> ";
	    $html_insert .= "</span>";
	    $html_insert .= "<br>";
	    $html_insert .= "<br>";
	    $html_insert .= "The document you have provided is CORRUPT or UNABLE TO BE OPENED.  <u>Please resubmit this document.  Please review our <a href='https://SUPPORT.".$_SESSION['template']['company']['domain']."'>https://SUPPORT.".$_SESSION['template']['company']['domain']."</a> for details about this issue.  After you have sourced/scanned a valid set of documents, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$_SESSION['admin']['banking_claim']['member_details']['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a>, and RESUBMIT your claims.";
	}	

	####################################################
	### MISMATCH #######################################
	####################################################
	
	if(stristr($return_type,"MISMATCH")) {
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
		$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
		$html_insert .= "<b>\"Mis-Matched Data\"</b> ";
		$html_insert .= "</span>";
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "The document that you have provided is acceptable, but the data you have provided does not match the details on your document.  Specifically:";

		
		# if(empty($email_receipt_verified_name_on_banking_account)) $html_insert .= "&nbsp;&nbsp;&nbsp;&bull; The name of the \"<u>BANKING ACCOUNT HOLDER</u>\" you submitted does not match that which is presented on your banking statement.<br>";
		# 
		# if(empty($email_receipt_verified_banking_account_number)) $html_insert .= "&nbsp;&nbsp;&nbsp;&bull; The \"<u>BANKING ACCOUNT NUMBER Number</u>\" you provided does not match that which is presented on your banking statement.<br>";
		# 
		# if(empty($email_receipt_verified_banking_routing_number)) $html_insert .= "&nbsp;&nbsp;&nbsp;&bull; Your ABA / BSB / IFSC / Sort Code / \"<u>LOCAL  Routing Number</u>\" does not match that which is presented on your banking statement.<br>";
		# 
		# if(empty($email_receipt_verified_banking_iban_swift)) $html_insert .= "&nbsp;&nbsp;&nbsp;&bull; Your SWIFT / IBAN / \"<u>INT'L Routing Number</u>\" does not match that which is presented on your banking statement.<br>";
		
		

		
		if(stristr($_GET['wallet_claim_status'],"PERSONALNAME")) {
			
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "Your PERSONAL NAME was displayed on the banking document your provided, but it NOT match your VERIFIED PERSONAL NAME (\"". $_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['firstname'] . " " .  $_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['middlename'] . " " .  $_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['lastname'] ."\").";
			$html_insert .= "&nbsp;";
			$html_insert .= "Noting you are VERIFIED to be operating as \"". $_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_name'] ." ". $_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_legal_extension'] ."\", <u>your PERSONAL NAME must be displayed on this proof this banking document</u>.";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='color:#444444; font-weight:normal;'>";
			$html_insert .= "<span style='color:#EE0000;'>";
			$html_insert .= "note:";
			$html_insert .= "</span>";
			$html_insert .= "&nbsp;";
			$html_insert .= "IF YOU WANT TO USE A <u>BUSINESS BANKING ACCOUNT</u>, you must EDIT/UPDATE your ". $_SESSION['template']['company']['name'] ." Account IDENTITY. Please review our <a href='https://". $_SESSION['template']['company']['host_support'] ."' target='". $_SESSION['template']['company']['host_support'] ."'>https://". $_SESSION['template']['company']['host_support'] ."</a> for more information and details about this issue.";
			$html_insert .= "</span>";
			$html_insert .= "</span>";
			
		}
		
		
		

		### DBA/GROUP
		if(stristr($_GET['wallet_claim_status'],"NAMEONACCOUNT")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";

			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "Although you provided the NAME on ACCOUNT, the name you provided did NOT <u>match EXACTLY</u> one of the following options:";
			$html_insert .= "<ul><b>";
			$html_insert .= "<li> " . $_SESSION['admin']['banking_claim']['parent_details']['name'] . "</li>";
			$html_insert .= "<li> " . $_SESSION['admin']['banking_claim']['account_business_details']['accountname'] . "</li>";
			$html_insert .= "</b></ul>";
			
			
			$html_insert .= "Please RESUBMIT your claims -- making sure that the ACCOUNT NAME matches EXACTLY one of the above options.";

			$html_insert .= "</span>";
			
		}
		
		
		
		
		//$_GET['wallet_claim_status'] = "BUSINESSNAME";
		if(stristr($_GET['wallet_claim_status'],"BUSINESSNAME")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "Your BUSINESS NAME was displayed on the banking document your provided, but it NOT match your BUSINESS NAME (\"". $_SESSION['admin']['banking_claim']['account_owner_details']['verified']['identity']['business_name'] . " " .   $_SESSION['admin']['banking_claim']['account_owner_details']['verified']['identity']['business_legal_extension'] ."\").";
			$html_insert .= "&nbsp;";
			$html_insert .= "Noting you are VERIFIED to be operating as \"". $_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_name'] ." ". $_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_legal_extension'] ."\", <u>THIS NAME must be displayed on this proof of banking document</u>.";
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='color:#444444; font-weight:normal;'>";
			$html_insert .= "<span style='color:#EE0000;'>";
			$html_insert .= "note:";
			$html_insert .= "</span>";
			$html_insert .= "&nbsp;";
			$html_insert .= "IF YOU WANT TO USE A <u>PERSONAL BANKING ACCOUNT</u>, you must EDIT/UPDATE your ". $_SESSION['template']['company']['name'] ." Account IDENTITY. Please review our <a href='https://". $_SESSION['template']['company']['host_support'] ."' target='". $_SESSION['template']['company']['host_support'] ."'>https://". $_SESSION['template']['company']['host_support'] ."</a> for more information and details about this issue.";
			$html_insert .= "</span>";
			$html_insert .= "</span>";
			
		}
		
		if(stristr($_GET['wallet_claim_status'],"ACCOUNTNUMBER")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "Your BANKING ACCOUNT NUMBER was displayed on the banking document your provided, but the account number on the document DID NOT match the BANKING ACCOUNT NUMBER that you provided (\"". $_SESSION['admin']['banking_claim']['wallet_details']['banking_account_number'] ."\").";
			$html_insert .= "&nbsp;";
			$html_insert .= "Please RESUBMIT the document, and take care to <u>confirm the BANKING ACCOUNT NUMBER you give us <b>EXACTLY MATCHES</b> the banking account number that is displayed on the Proof of Banking document you are providing</u>.";
			$html_insert .= "</span>";
		}
	
		if(stristr($_GET['wallet_claim_status'],"SWIFT")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "Your SWIFT ACCOUNT NUMBER was displayed on the banking document your provided, but the account number on the document DID NOT match the SWIFT ACCOUNT NUMBER that you provided (\"". $_SESSION['admin']['banking_claim']['wallet_details']['banking_iban_swift'] ."\").";
			$html_insert .= "&nbsp;";
			$html_insert .= "Please RESUBMIT the document, and take care to <u>confirm the BANKING ACCOUNT NUMBER you give us <b>EXACTLY MATCHES</b> the banking account number that is displayed on the Proof of Banking document you are providing</u>.";
			$html_insert .= "</span>";
		}
	
		if(stristr($_GET['wallet_claim_status'],"LOCALROUTNINGNUMBER")) {
			$html_insert .= "<br>";
			$html_insert .= "<br>";
			$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
			$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
			$html_insert .= "Your LOCAL ROUTING NUMBER (ABA / BSB / IFSC) was displayed on the banking document your provided, but the account number on the document DID NOT match the LOCAL ROUTING NUMBER (ABA / BSB / IFSC) that you provided (\"". $_SESSION['admin']['banking_claim']['wallet_details']['banking_routing_number'] ."\").";
			$html_insert .= "&nbsp;";
			$html_insert .= "Please RESUBMIT the document, and take care to <u>confirm the BANKING ACCOUNT NUMBER you give us <b>EXACTLY MATCHES</b> the banking account number that is displayed on the Proof of Banking document you are providing</u>.";
			$html_insert .= "</span>";
		}
		
	
		
		$html_insert .= "<br>";
		$html_insert .= "<br>";
		$html_insert .= "To correct this issue, please log-in to your account, <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a> to your account. Then SELECT ACCOUNT (to manage) --> ACCOUNT SETTINGS --> IDENTITY VERIFICATION STATUS --> then RESUBMIT your claims -- making sure the data you enter into the fields <u>MATCHES EXACTLY</u> to the details printed on your document(s).";
	}
	
	$html_insert .= "<br>";
	
	// test("html_insert",$html_insert);
	// exit;
	
	

}



######################################################
################ admin_banking_claim_verified ########
######################################################

if($email_receipt == "admin_banking_claim_verified") {

	/*
	$dear_who
	$send_to
	$member_password
	$member_emailaddress
	$account_type
	$account_type
	*/
	

	//$email_descriptive = strtoupper("(ALERT!)");
	

	//$dear_who = $email_firstname_lastname;
	$email_subject = "update: ".$account_type." ".$claim_type." (Verified!)";
	$text_insert = "(what's up text space!?)";




	$html_insert = "<br>";
	$html_insert .= "The proof of <u><b>".$account_type." ".$claim_type."</b></u> you have submitted <b>has been VERIFIED</b>!";
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	
	$html_insert .= "<nobr>";
	$html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
	$html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
	$html_insert .= $_SESSION['admin']['wallet_claim_details']['name_of_banking_institution'];
	
	$html_insert .= "&nbsp;|&nbsp;";
	
	if(
	(stristr($_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_legal_extension'],"PDBA")) ||
	(stristr($_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_legal_extension'],"GROUP"))
	) {
		$html_insert .= $_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['firstname'] . " " . $_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['middlename'] . " " .$_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['lastname'];

	} else {
		$html_insert .= $_SESSION['admin']['banking_claim']['account_owner_details']['verified']['identity']['business_name'] . " " . $_SESSION['admin']['banking_claim']['account_owner_details']['verified']['identity']['business_legal_extension'];
	}

	$html_insert .= "&nbsp;|&nbsp;...";
	$html_insert .= substr($_SESSION['admin']['wallet_claim_details']['banking_account_number'],-6);
	$html_insert .= "</span>";
	$html_insert .= "</nobr>";

	$html_insert .= "<br>";
	$html_insert .= "<br>";
	
	$html_insert .= "For more information about our identity verification process, and your legal Rights and Protections defined under YOU OWN YOU&trade; -- our open source legal framework, please review <a href='https://SUPPORT.".$_SESSION['template']['company']['domain']."'>https://SUPPORT.".$_SESSION['template']['company']['domain']."</a>, or <a href='https://LOGIN.".$_SESSION['template']['company']['domain']."/member_emailaddress=".$email_member_details['emailaddress']."'>https://LOGIN.".$_SESSION['template']['company']['domain']."</a> to your account, then SELECT ACCOUNT (to manage) --> ACCOUNT SETTINGS --> REGISTERED BANKING ACCOUNTS.";
	$html_insert .= "<br>";

	
	

}



######################################################
################ admin_complete_banking_profile_claim_verified ########
######################################################

if($email_receipt == "admin_complete_banking_profile_claim_verified") {

	/*
	$dear_who
	$send_to
	$member_password
	$member_emailaddress
	$account_type
	$account_type
	*/
	
	// available vars:
	//$_SESSION['admin']['banking_claim']['account_business_details']
	//$_SESSION['admin']['banking_claim']['member_details']

	//$email_descriptive = strtoupper("(ALERT!)");
	
	//$email_from_name = "update.". $_SESSION['template']['company']['domain'];
	//$dear_who = $email_firstname_lastname;
	
	$email_subject = $_SESSION['admin']['banking_claim']['account_business_details']['accountname'] ." ". $_SESSION['admin']['banking_claim']['account_business_details']['business_type'] ." (VERIFIED!)";
	$text_insert = "(what's up text space!?)";





	
	if(
	(!empty($_SESSION['admin']['banking_claim']['member_details']['firstname'])) &&
	(!empty($_SESSION['admin']['banking_claim']['member_details']['middlename']))
	) {
		$tmp_insert_middlename_space = " ";
	}
	

//$_SESSION['admin']['banking_claim']['account_business_details']

	$html_insert = "<br>";
	$html_insert .= "Personal Profile: ";
	$html_insert .= "<b>";
	$html_insert .= $_SESSION['admin']['banking_claim']['member_details']['firstname'] . $tmp_insert_middlename_space . $_SESSION['admin']['banking_claim']['member_details']['middlename'] . " ". $_SESSION['admin']['banking_claim']['member_details']['lastname'];
	$html_insert .= "</b>";
	$html_insert .= "<br>";
	$html_insert .= "Business Profile: <b>". $_SESSION['admin']['banking_claim']['account_business_details']['accountname'] ." ". $_SESSION['admin']['banking_claim']['account_business_details']['business_type'] . "</b><br>";
	$html_insert .= "Banking Profile: <b>". $_SESSION['admin']['banking_claim']['wallet_details']['name_of_banking_institution'] . "</b> | ...". substr($_SESSION['admin']['banking_claim']['wallet_details']['banking_account_number'],-6) ."<br>";
	$html_insert .= "Profile Status: <span style='color:#00AA00;'><b>VERIFIED!</b></span><br>";
	$html_insert .= "<br>";
	$html_insert .= "<b>You may now WITHDRAW funds as they accumulate for collection <u>in your \"AVAILABLE BALANCE</u>\".</b>";
	$html_insert .= "<br>";
	
	
	## $html_insert .= "<nobr>";
	## $html_insert .= "<span style='font-size:125%; font-weight:bold;'>";
	## $html_insert .= "&nbsp;&nbsp;&nbsp;<b>&bull;</b>&nbsp;";
	## $html_insert .= $_SESSION['admin']['wallet_claim_details']['name_of_banking_institution'];
	## 
	## $html_insert .= "&nbsp;|&nbsp;";
	## 
	## if(
	## (stristr($_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_legal_extension'],"PDBA")) ||
	## (stristr($_SESSION['admin']['banking_claim']['account_business_details']['verified']['identity']['business_legal_extension'],"GROUP"))
	## ) {
	## 	$html_insert .= $_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['firstname'] . " " . $_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['middlename'] . " " .$_SESSION['admin']['banking_claim']['member_details']['verified']['identity']['lastname'];
	## 
	## } else {
	## 	$html_insert .= $_SESSION['admin']['banking_claim']['account_owner_details']['verified']['identity']['business_name'] . " " . $_SESSION['admin']['banking_claim']['account_owner_details']['verified']['identity']['business_legal_extension'];
	## }
	## 
	## $html_insert .= "&nbsp;|&nbsp;...";
	## $html_insert .= substr($_SESSION['admin']['wallet_claim_details']['banking_account_number'],-6);
	## $html_insert .= "</span>";
	## $html_insert .= "</nobr>";

	$html_insert .= "<br>";
	$html_insert .= "<br>";
	
	$html_insert .= "For more information about our identity verification process, and your legal Rights and Protections defined under YOU OWN YOU&trade; -- our open source legal framework, please review <a href='https://SUPPORT.".$_SESSION['template']['company']['domain']."'>https://SUPPORT.".$_SESSION['template']['company']['domain']."</a>.";
	$html_insert .= "<br>";

	
	

}



##########################################
################ PASSWORD REMINDER #######
##########################################

if($email_receipt == "password reminder") {

	/*
	$dear_who
	$send_to
	$member_password
	*/
	

	$email_descriptive = strtoupper("(ALERT!)");
	
	if(!$dear_who) $dear_who = $member->firstname . " " . $member->lastname;
	if(!$send_to) $send_to = $member->emailaddress;
	if(!$member_password) $member_password = $member->password;
	
	$email_subject = "Account Reminder...";
	$text_insert = "Here is the account information you requested:

" . $member_password;




	$html_insert = "
Here is the account information you requested:

<b><font color='880000'>" . $member_password . "</font></b>
";


//test("html_insert",$html_insert);



}



##########################################
################ withdraw_atm_issuance #######
##########################################

logger3("email_receipt",$email_receipt);

if($email_receipt == "withdraw_atm_issuance") {

	/*
	$dear_who
	$send_to
	$member_password
	*/
	

	$email_descriptive = strtoupper("(RECEIPT)");
	
	if(!$dear_who) $dear_who = $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
	if(!$send_to) $send_to = $_SESSION['member']['emailaddress'];
	
	logger3("send_to",$send_to);
	
	$email_subject = "ATM Debit Card Issuance";
	$text_insert = "text";




	$html_insert = "
Here is a receipt of the information you have registered to your " . $_SESSION['template']['company']['name']  . " ATM Debit Card:


<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Email Address:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['emailaddress'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	First Name:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['firstname'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Last Name:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['lastname'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Government ID:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['government_id'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Citizenship:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['citizenship'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Birth Date:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['birthdate'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Birth City:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['birth_city'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Birth Country:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['birth_country'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Political Position:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['political_position'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Phone Calling Code:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['phone_calling_code'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Phone Number:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['phone_number'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Phone Type:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['phone_type'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Mailing Street (1):
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['mailing_street_1'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Mailing Street (2):
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['mailing_street_2'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Mailing City:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['mailing_city'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Mailing State:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['mailing_state'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Mailing Region:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['mailing_region'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Mailing Postal Code:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['mailing_postal_code'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Mailing Country:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . $_SESSION['withdrawal']['mailing_country'] . "
</span>  

<span style='color:#000088; font-weight:normal; font-family:arial,verdana; font-size:14;'>
	Datetime Requested:
</span> &nbsp; 
<span style='color:#444444; font-weight:bold; font-family:verdana,arial; font-size:14;'>
	" . timezone($_SESSION['member']['memberid'],$timestamp,"datetime") . "
</span>

";

	logger3("timestamp",$timestamp);
	logger3("html_insert",$html_insert);

}



##########################################################
### approved_withdrawal_to_debit_card ####################
##########################################################

logger3("email_receipt",$email_receipt);

if($email_receipt == "approved_withdrawal_to_debit_card") {

	/*
	$dear_who
	$send_to
	$member_password
	*/
	

	$email_descriptive = strtoupper("(RECEIPT)");
	
	if(!$dear_who) $dear_who = $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . " (& " . $_SESSION['account']['accountname'] . ")";
	
	if(!$send_to) $send_to = $_SESSION['account']['emailaddress'];
	
	logger3("send_to",$send_to);


	###########################################################
	### SUBJECT
	
	$email_subject = "ACCOUNT WITHDRAWAL: " . $_SESSION['account']['currency_0_iso3'] . " " . currency_format($_SESSION['transaction']['requested_value']);
	
	if(multicurrency()) {
		$email_subject .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
	}
		
	###########################################################
	### TEXT
	
	$text_insert = $_SESSION['template']['company']['domain'];
	
# 	$text_insert = NULL;
# 	$text_insert .= "
# Account Activity:  " . $_SESSION['account']['currency_0_iso3'] . " " . $_SESSION['transaction']['requested_value'];
# 	
# 	if(multicurrency()) {
# 	  $text_insert .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
# 	}
# 	$text_insert .= " WITHDRAWAL to your Debit Card has been APPROVED.
# 	
# Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"
# 	
# Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "
# 	
# TIMESTAMP of Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
# 
	###########################################################
	### HTML
	
	$html_insert = NULL;
	$html_insert .= "</b>Account Activity:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['account']['currency_0_iso3'] . " " . $_SESSION['transaction']['requested_value'];
	
	if(multicurrency()) {
		$html_insert .= "&nbsp;";
		$html_insert .= "(";
		$html_insert .= $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'];
		$html_insert .= ")";
	}
	$html_insert .= "&nbsp;";
	$html_insert .= "WITHDRAWAL to your Debit Card has been APPROVED.";
	$html_insert .= "";
	
	$html_insert .= "";
	$html_insert .= "</b>Affected Account:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= "\"" . $_SESSION['account']['accountname'] . "\"";
	$html_insert .= "";
	
	$html_insert .= "";
	$html_insert .= "</b>Initiated By:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
	$html_insert .= "";
	
	$html_insert .= "";
	$html_insert .= "</b>TIMESTAMP of Voice Authorization:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= timezone($_SESSION['member']['memberid'],$_SESSION['transaction']['datetime_requested'],"goodlooking");

	logger3("html_insert",$html_insert);
}


##########################################################
### APPROVED_withdrawal_to_swift_account ####################
##########################################################

logger3("email_receipt",$email_receipt);

if($email_receipt == "approved_withdrawal_to_swift_account") {

	/*
	$dear_who
	$send_to
	$member_password
	*/
	
	if(empty($email_receipt_withdrawal_status)) $email_receipt_withdrawal_status = "APPROVED - Pending Release";

	//$email_descriptive = strtoupper("(RECEIPT)");
	
	if(!$dear_who) $dear_who = $_SESSION['account']['accountname'] . " (& " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ")";
	
	if(!$send_to) $send_to = $_SESSION['account']['emailaddress'];
	
	//test("send_to",$send_to);
	
	$email_from_name = "status.".$_SESSION['template']['company']['name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];


	###########################################################
	### SUBJECT
	
	$email_subject = "Account Withdrawal APPROVED: " . $tmp_account_details['currency_0_iso3'] . " " . currency_format($_SESSION['transaction']['requested_value']);
	
	if(multicurrency()) {
		$email_subject .= " (" . $tmp_account_details['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
	}
		
	###########################################################
	### TEXT
	
	$text_insert = $_SESSION['template']['company']['domain'];
	
# 	$text_insert = NULL;
# 	$text_insert .= "
# Account Activity:  " . $_SESSION['account']['currency_0_iso3'] . " " . $_SESSION['transaction']['requested_value'];
# 	
# 	if(multicurrency()) {
# 	  $text_insert .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
# 	}
# 	$text_insert .= " WITHDRAWAL to your Debit Card has been APPROVED.
# 	
# Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"
# 	
# Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "
# 	
# TIMESTAMP of Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
# 
	###########################################################
	### HTML
	
	$html_insert = NULL;
	$html_insert .= "</b>Account Activity:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['account']['currency_0_iso3'] . " " . $_SESSION['transaction']['requested_value'];
	
	if(multicurrency()) {
		$html_insert .= "&nbsp;";
		$html_insert .= "(";
		$html_insert .= $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'];
		$html_insert .= ")";
	}
	$html_insert .= "&nbsp;";
	$html_insert .= "WITHDRAWAL.";
	$html_insert .= "<br>";

	$html_insert .= "";
	$html_insert .= "</b>SOURCE Account:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= "\"" . $_SESSION['account']['accountname'] . "\" (@ ".$_SESSION['template']['company']['name'].")";
	$html_insert .= "<br>";

	###
	$html_insert .= "";
	$html_insert .= "</b>GROSS WITHDRAWAL Amount:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['account']['currency_0_iso3'] . " " . $_SESSION['transaction']['requested_value'];
	$html_insert .= "<br>";
	# if(multicurrency()) {
	# 	$html_insert .= "&nbsp;";
	# 	$html_insert .= "(";
	# 	$html_insert .= $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'];
	# 	$html_insert .= ")";
	# }
	###

	$html_insert .= "";
	$html_insert .= "</b>Withdrawal DESTINATION:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['withdrawal']['name_of_bank'] . " / " . $_SESSION['withdrawal']['bank_account_number'];
	$html_insert .= "<br>";




	
	$html_insert .= "";
	$html_insert .= "</b>AUTHORIZED by:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['middlename'] . " " . $_SESSION['member']['lastname'];
	$html_insert .= "<br>";


	
	$html_insert .= "";
	$html_insert .= "</b>TIMESTAMP of Voice Authorization:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= timezone($_SESSION['member']['memberid'],$_SESSION['transaction']['requested_datetime'],"goodlooking");
	$html_insert .= "<br>";
	
	
	
	$html_insert .= "";
	$html_insert .= "</b>Withdrawal STATUS:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $email_receipt_withdrawal_status; //"APPROVED - Pending Release";
	
	$html_insert .= "<br>";
	
	$html_insert .= "<br>";
	$html_insert .= "<u>TRANSACTION STATUS DETAILS</u>:</b> &nbsp; This withdrawal have been authorized and approved.  You may now expect these funds to clear into your bank account within four (4) business days -- starting from the TIMESTAMP of the voice authorization -- noting 'business days' do NOT include Saturdays and Sundays).";
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	$html_insert .= "<b>Additional <u>FX NOTES</u>:</b> &nbsp;Please expect a follow-up email receipt from ".$_SESSION['template']['company']['name']." -- usually within 48 hours -- that will confirm our FX quote, along with a <b>FINAL CONFIRMATION OF TRANSFER</b> of said funds to your bank.";
	$html_insert .= "<br>";

	$html_insert .= "<br>";
	$html_insert .= "Thank you for placing your <b><u>trust in ".$_SESSION['template']['company']['name']."</b></u>.";

	
	//test("html_insert",$html_insert);
}





##########################################################
### COMPLETED_withdrawal_to_swift_account ###############
##########################################################


logger3("email_receipt",$email_receipt);
if($email_receipt == "completed_withdrawal_to_swift_account") {

	logger3("email_receipt",$email_receipt);

	/*
	$dear_who
	$send_to
	$member_password
	*/
	

	//$email_descriptive = strtoupper("(RECEIPT)");
	
	$tmp_member_details = member($_SESSION['admin']['withdrawal']['transaction_details']['memberid']);
	$tmp_account_details = account($_SESSION['admin']['withdrawal']['transaction_details']['accountid']);
	
	
	
	if(!$dear_who) $dear_who = $tmp_account_details['accountname'] . " & " . $tmp_member_details['firstname'] . " " . $tmp_member_details['lastname'];
	
	if(!$send_to) $send_to = $tmp_account_details['emailaddress'];
	
	logger3("send_to",$send_to);
	
	$email_from_name = "receipt.".$_SESSION['template']['company']['name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];


	###########################################################
	### SUBJECT
	
	$email_subject = "Account Withdrawal COMPLETED: " . $tmp_account_details['currency_0_iso3'] . " " . currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value']);
	
	# if(multicurrency()) {
	# 	$email_subject .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
	# }
		
	###########################################################
	### TEXT
	
	$text_insert = $_SESSION['template']['company']['domain'];
	
	# 	$text_insert = NULL;
	# 	$text_insert .= "
	# Account Activity:  " . $_SESSION['account']['currency_0_iso3'] . " " . $_SESSION['transaction']['requested_value'];
	# 	
	# 	if(multicurrency()) {
	# 	  $text_insert .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
	# 	}
	# 	$text_insert .= " WITHDRAWAL to your Debit Card has been APPROVED.
	# 	
	# Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"
	# 	
	# Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "
	# 	
	# TIMESTAMP of Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
	# 
	###########################################################
	### HTML
	
	$html_insert = NULL;
	###
	$html_insert .= "</b>Account Activity:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'] . " " . $_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value'];

	$html_insert .= "&nbsp;";
	$html_insert .= "WITHDRAWAL";
	$html_insert .= "<br>";
	###
	
	$html_insert .= "";
	$html_insert .= "</b>SOURCE Account Name:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['business_account_details']['business_name'] . " " . $_SESSION['admin']['withdrawal']['business_account_details']['business_type'];
	$html_insert .= "<br>";
	

	$html_insert .= "";
	$html_insert .= "</b>GROSS Withdrawal Amount:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value'] . " (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "</b>Processing & TRANSFER FEE:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['fee_total_value']." (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "<br>";	

	$html_insert .= "<span style='color:#00AA00; font-weight:bold;'>";
	$html_insert .= "FINAL / NET TRANSFER AMOUNT:";
	$html_insert .= "&nbsp;";
	$html_insert .= currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_net_value']) . " (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "</span>";
	$html_insert .= "<br>";
	
	
	
	$html_insert .= "";
	$html_insert .= "</b>AUTHORIZED by:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['personal_details']['firstname'] . " " . $_SESSION['admin']['withdrawal']['personal_details']['middlename'] . " " . $_SESSION['admin']['withdrawal']['personal_details']['lastname'];
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "</b>TIMESTAMP of APPROVED Voice Authorization:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['requested_datetime'] . " (GMT)";
	$html_insert .= "<hr>";
	
	
	
	
	
	$html_insert .= "";
	$html_insert .= "</b>DESTINATION Banking Institution Name:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['wallet_details']['name_of_banking_institution'];
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "</b>Name of DESTINATION ACCOUNT HOLDER / OWNER:<b>";
	$html_insert .= "&nbsp;";
	if(stristr($_SESSION['admin']['withdrawal']['business_account_details']['business_type'],"PDBA")) {
		$html_insert .= $_SESSION['admin']['withdrawal']['personal_details']['firstname'] . " " . $_SESSION['admin']['withdrawal']['personal_details']['middlename'] . " " . $_SESSION['admin']['withdrawal']['personal_details']['lastname'];

		$html_insert .= "<br>";
		$html_insert .= "DOING BUSINESS AS: ". $_SESSION['admin']['withdrawal']['business_account_details']['business_name'] . " " . $_SESSION['admin']['withdrawal']['business_account_details']['business_type'];
	} else {
		$html_insert .= $_SESSION['admin']['withdrawal']['business_account_details']['business_name'] . " " . $_SESSION['admin']['withdrawal']['business_account_details']['business_type'];
	}
	
	$html_insert .= "<br>";


	$html_insert .= "";
	$html_insert .= "</b>Name of DESTINATION ACCOUNT NUMBER:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['wallet_details']['banking_account_number'];
	$html_insert .= "<br>";



	
	// $html_insert .= "<hr>";
	// $html_insert .= "</b>FX RATE (USD:INR):<b>";
	// $html_insert .= "&nbsp;";
	// $html_insert .= $_SESSION['admin']['withdrawal']['fx_rate'];
	// $html_insert .= "<br>";
	
	
	// $html_insert .= "";
	// $html_insert .= "</b>FINAL / COMPLETED TRANSFER</b> Amount:<b>";
	// $html_insert .= "&nbsp;";
	// $html_insert .= currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_net_value']*$_SESSION['admin']['withdrawal']['fx_rate']) . " (INR)";
	// $html_insert .= "<br>";


	$html_insert .= "WITHDRAWAL STATUS:";
	$html_insert .= "&nbsp;";
	$html_insert .= "<span style='color:#00AA00; font-weight:bold;'>";
	$html_insert .= "COMPLETED - Funds have been sent.";
	$html_insert .= "</span>";
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "TIMESTAMP of Withdrawal Completion:";
	$html_insert .= "&nbsp;<span style='color:#00AA00; font-weight:bold;'>";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['updated_datetime'] . " (GMT)</span>";
	$html_insert .= "<hr>";
	
		
	
	
	$html_insert .= "<span style='color:#CC0000; font-weight:bold;'>IMPORTANT NOTE:</span> Please expect funds to clear into your ". $_SESSION['admin']['withdrawal']['wallet_details']['name_of_banking_institution'] . " account <u>within&nbsp;5&nbsp;(five)&nbsp;business&nbsp;days</u> of <span style='color:#00AA00; font-weight:bold;'>'". $_SESSION['admin']['withdrawal']['transaction_details']['updated_datetime'] ."' (GMT)</span>.";
	$html_insert .= "<center>";
	$html_insert .= "<u>ALERT</u>! \"Saturdays\" and \"Sundays\" <u>are NOT \"business days</u>\".";
	$html_insert .= "</center>";
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	$html_insert .= "<span style='font-weight:normal;'>";
	$html_insert .= "...thank you for placing your <b><u>trust in ".$_SESSION['template']['company']['name']."</b></u>.";
	$html_insert .= "</span>";
	logger3("html_insert",$html_insert);
}








##########################################################
### CANCELED_withdrawal_to_swift_account ###############
##########################################################


logger3("email_receipt",$email_receipt);
if($email_receipt == "canceled_withdrawal_to_swift_account") {

	logger3("email_receipt",$email_receipt);

	/*
	$dear_who
	$send_to
	$member_password
	*/
	

	//$email_descriptive = strtoupper("(RECEIPT)");
	
	$tmp_member_details = member($_SESSION['admin']['withdrawal']['transaction_details']['memberid']);
	$tmp_account_details = account($_SESSION['admin']['withdrawal']['transaction_details']['accountid']);
	
	
	
	if(!$dear_who) $dear_who = $tmp_account_details['accountname'] . " & " . $tmp_member_details['firstname'] . " " . $tmp_member_details['lastname'];
	
	if(!$send_to) $send_to = $tmp_account_details['emailaddress'];
	
	logger3("send_to",$send_to);
	
	$email_from_name = "update.".$_SESSION['template']['company']['name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];


	###########################################################
	### SUBJECT
	
	$email_subject = "Account Withdrawal CANCELED: " . $tmp_account_details['currency_0_iso3'] . " " . currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value']);
	
	# if(multicurrency()) {
	# 	$email_subject .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
	# }
		
	###########################################################
	### TEXT
	
	$text_insert = $_SESSION['template']['company']['domain'];
	
	# 	$text_insert = NULL;
	# 	$text_insert .= "
	# Account Activity:  " . $_SESSION['account']['currency_0_iso3'] . " " . $_SESSION['transaction']['requested_value'];
	# 	
	# 	if(multicurrency()) {
	# 	  $text_insert .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
	# 	}
	# 	$text_insert .= " WITHDRAWAL to your Debit Card has been APPROVED.
	# 	
	# Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"
	# 	
	# Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "
	# 	
	# TIMESTAMP of Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
	# 
	###########################################################
	### HTML
	
	$html_insert = NULL;
	###
	$html_insert .= "</b>Account Activity:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'] . " " . $_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value'];

	$html_insert .= "&nbsp;";
	$html_insert .= "WITHDRAWAL";
	$html_insert .= "<br>";
	###
	
	$html_insert .= "";
	$html_insert .= "</b>SOURCE Account Name:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $tmp_account_details['accountname'] . " " . $tmp_account_details['business_type'];
	$html_insert .= "<br>";
	

	$html_insert .= "";
	$html_insert .= "</b>GROSS Withdrawal Amount:<b>";
	$html_insert .= "&nbsp;<strike>";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value'] . " (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "</strike><br>";
	
	$html_insert .= "";
	$html_insert .= "</b>Processing & TRANSFER FEE:<b>";
	$html_insert .= "&nbsp;<strike>";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['fee_total_value']." (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "</strike><br>";	

	$html_insert .= "<span style='color:#00AA00; font-weight:bold;'>";
	$html_insert .= "FINAL / NET TRANSFER AMOUNT:";
	$html_insert .= "&nbsp;<strike>";
	$html_insert .= currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_net_value']) . " (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "</strike></span>";
	$html_insert .= "<br>";
	
	
	
	$html_insert .= "";
	$html_insert .= "</b>AUTHORIZED by:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['personal_details']['firstname'] . " " . $_SESSION['admin']['withdrawal']['personal_details']['middlename'] . " " . $_SESSION['admin']['withdrawal']['personal_details']['lastname'];
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "</b>TIMESTAMP of APPROVED Voice Authorization:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['requested_datetime'] . " (GMT)";
	$html_insert .= "<hr>";
	
	
	
	
	
	# $html_insert .= "";
	# $html_insert .= "</b>DESTINATION Banking Institution Name:<b>";
	# $html_insert .= "&nbsp;";
	# $html_insert .= $_SESSION['admin']['withdrawal']['wallet_details']['name_of_banking_institution'];
	# $html_insert .= "<br>";
	# 
	# $html_insert .= "";
	# $html_insert .= "</b>Name of DESTINATION ACCOUNT HOLDER / OWNER:<b>";
	# $html_insert .= "&nbsp;";
	# $html_insert .= $_SESSION['admin']['withdrawal']['ultimate_businessid_identity']['business_name'] . " " . $_SESSION['admin']['withdrawal']['ultimate_businessid_identity']['business_legal_extension'];
	# $html_insert .= "<br>";
	# 
	# 
	# $html_insert .= "";
	# $html_insert .= "</b>Name of DESTINATION ACCOUNT NUMBER:<b>";
	# $html_insert .= "&nbsp;";
	# $html_insert .= $_SESSION['admin']['withdrawal']['wallet_details']['banking_account_number'];
	# $html_insert .= "<br>";



	
	// $html_insert .= "<hr>";
	// $html_insert .= "</b>FX RATE (USD:INR):<b>";
	// $html_insert .= "&nbsp;";
	// $html_insert .= $_SESSION['admin']['withdrawal']['fx_rate'];
	// $html_insert .= "<br>";
	
	
	// $html_insert .= "";
	// $html_insert .= "</b>FINAL / COMPLETED TRANSFER</b> Amount:<b>";
	// $html_insert .= "&nbsp;";
	// $html_insert .= currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_net_value']*$_SESSION['admin']['withdrawal']['fx_rate']) . " (INR)";
	// $html_insert .= "<br>";


	$html_insert .= "WITHDRAWAL STATUS:";
	$html_insert .= "&nbsp;";
	$html_insert .= "<span style='color:#EE0000; font-weight:normal;'>";
	$html_insert .= "<b>ADMINISTRATIVE CANCELATION</b> - All funds (". $_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'] . " " . $_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value'] .") have reverted back to your account balance.";
	$html_insert .= "</span>";
	$html_insert .= "<br>";

	if(stristr($_POST['request_updated_banking_documents'],"YES")) {
		$html_insert .= "IMPORTANT ADMINISTRATIVE MESSAGE:";
		$html_insert .= "&nbsp;";
		$html_insert .= "<span style='color:#EE0000; font-weight:normal;'>";
		$html_insert .= "The banking details you provided were <b><u>REJECTED BY YOUR BANKING INSTITUTION</u></b>. Please confirm and RESUBMIT your claims by logging into your ".$_SESSION['template']['company']['name']." ACCOUNT --> ACCOUNT SETTINGS --> BANKING PROFILE.";
		$html_insert .= "</span>";
		$html_insert .= "<br>";
	}
	
	$html_insert .= "";
	$html_insert .= "TIMESTAMP of Withdrawal Cancelation:";
	$html_insert .= "&nbsp;<span style='color:#00AA00; font-weight:bold;'>";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['updated_datetime'] . " (GMT)</span>";
	$html_insert .= "<hr>";
	
		
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	$html_insert .= "<span style='font-weight:normal;'>";
	$html_insert .= "...thank you for placing your <b><u>trust in ".$_SESSION['template']['company']['name']."</b></u>.";
	$html_insert .= "</span>";
	//test("html_insert",$email_subject . "<br>". $html_insert);
	//exit;
}



##########################################################
### SEND_WITHDRAWAL_BATCHOUT  ############################
##########################################################


logger3("email_receipt",$email_receipt);
if($email_receipt == "send_withdrawal_batchout") {

	logger3("email_receipt",$email_receipt);

	/*
	$dear_who
	$send_to
	$member_password
	*/
	

	
	if(!$dear_who) $dear_who = $tmp_account_details['accountname'] . " & " . $tmp_member_details['firstname'] . " " . $tmp_member_details['lastname'];
	
	if(!$send_to) $send_to = $tmp_account_details['emailaddress'];
	
	logger3("send_to",$send_to);
	
	$email_from_name = "receipt.".$_SESSION['template']['company']['name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];


	###########################################################
	### SUBJECT
	
	$email_subject = "Account Withdrawal COMPLETED: " . $_SESSION['account']['currency_0_iso3'] . " " . currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value']);
	
	# if(multicurrency()) {
	# 	$email_subject .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
	# }
		
	###########################################################
	### TEXT
	
	$text_insert = $_SESSION['template']['company']['domain'];
	
	# 	$text_insert = NULL;
	# 	$text_insert .= "
	# Account Activity:  " . $_SESSION['account']['currency_0_iso3'] . " " . $_SESSION['transaction']['requested_value'];
	# 	
	# 	if(multicurrency()) {
	# 	  $text_insert .= " (" . $_SESSION['account']['currency_code_1'] . " " . $_SESSION['transaction']['currency_1_request'] . ")";
	# 	}
	# 	$text_insert .= " WITHDRAWAL to your Debit Card has been APPROVED.
	# 	
	# Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"
	# 	
	# Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "
	# 	
	# TIMESTAMP of Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
	# 
	###########################################################
	### HTML
	
	$html_insert = NULL;
	###
	$html_insert .= "</b>Account Activity:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'] . " " . $_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value'];

	$html_insert .= "&nbsp;";
	$html_insert .= "WITHDRAWAL";
	$html_insert .= "<br>";
	###
	
	$html_insert .= "";
	$html_insert .= "</b>SOURCE Account Name:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['dba_businessid_details']['business_name'] . " " . $_SESSION['admin']['withdrawal']['dba_businessid_details']['business_legal_extension'] . " &nbsp;(aka, ".$_SESSION['admin']['withdrawal']['ultimate_businessid_identity']['business_name'] . " " . $_SESSION['admin']['withdrawal']['ultimate_businessid_identity']['business_legal_extension'] .")";
	$html_insert .= "<br>";
	

	$html_insert .= "";
	$html_insert .= "</b>GROSS Withdrawal Amount:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['transaction_gross_value'] . " (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "</b>Processing & TRANSFER FEE:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['fee_total_value']." (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "<br>";	

	$html_insert .= "<span style='color:#00AA00; font-weight:bold;'>";
	$html_insert .= "FINAL / NET TRANSFER AMOUNT:";
	$html_insert .= "&nbsp;";
	$html_insert .= currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_net_value']) . " (".$_SESSION['admin']['withdrawal']['transaction_details']['currency_0_iso3'].")";
	$html_insert .= "</span>";
	$html_insert .= "<br>";
	
	
	
	$html_insert .= "";
	$html_insert .= "</b>AUTHORIZED by:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['personal_details']['firstname'] . " " . $_SESSION['admin']['withdrawal']['personal_details']['middlename'] . " " . $_SESSION['admin']['withdrawal']['personal_details']['lastname'];
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "</b>TIMESTAMP of APPROVED Voice Authorization:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['requested_datetime'] . " (GMT)";
	$html_insert .= "<hr>";
	
	
	
	
	
	$html_insert .= "";
	$html_insert .= "</b>DESTINATION Banking Institution Name:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['wallet_details']['name_of_banking_institution'];
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "</b>Name of DESTINATION ACCOUNT HOLDER / OWNER:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['ultimate_businessid_identity']['business_name'] . " " . $_SESSION['admin']['withdrawal']['ultimate_businessid_identity']['business_legal_extension'];
	$html_insert .= "<br>";


	$html_insert .= "";
	$html_insert .= "</b>Name of DESTINATION ACCOUNT NUMBER:<b>";
	$html_insert .= "&nbsp;";
	$html_insert .= $_SESSION['admin']['withdrawal']['wallet_details']['banking_account_number'];
	$html_insert .= "<br>";



	
	// $html_insert .= "<hr>";
	// $html_insert .= "</b>FX RATE (USD:INR):<b>";
	// $html_insert .= "&nbsp;";
	// $html_insert .= $_SESSION['admin']['withdrawal']['fx_rate'];
	// $html_insert .= "<br>";
	
	
	// $html_insert .= "";
	// $html_insert .= "</b>FINAL / COMPLETED TRANSFER</b> Amount:<b>";
	// $html_insert .= "&nbsp;";
	// $html_insert .= currency_format($_SESSION['admin']['withdrawal']['transaction_details']['transaction_net_value']*$_SESSION['admin']['withdrawal']['fx_rate']) . " (INR)";
	// $html_insert .= "<br>";


	$html_insert .= "WITHDRAWAL STATUS:";
	$html_insert .= "&nbsp;";
	$html_insert .= "<span style='color:#00AA00; font-weight:bold;'>";
	$html_insert .= "COMPLETED - Funds have been sent.";
	$html_insert .= "</span>";
	$html_insert .= "<br>";
	
	$html_insert .= "";
	$html_insert .= "TIMESTAMP of Withdrawal Completion:";
	$html_insert .= "&nbsp;<span style='color:#00AA00; font-weight:bold;'>";
	$html_insert .= $_SESSION['admin']['withdrawal']['transaction_details']['updated_datetime'] . " (GMT)</span>";
	$html_insert .= "<hr>";
	
		
	
	
	$html_insert .= "<span style='color:#CC0000; font-weight:bold;'>IMPORTANT NOTE:</span> Please expect funds to clear into your ". $_SESSION['admin']['withdrawal']['wallet_details']['name_of_banking_institution'] . " account <u>within&nbsp;5&nbsp;(five)&nbsp;business&nbsp;days</u> of <span style='color:#00AA00; font-weight:bold;'>'". $_SESSION['admin']['withdrawal']['transaction_details']['updated_datetime'] ."' (GMT)</span>.";
	$html_insert .= "<center>";
	$html_insert .= "<u>ALERT</u>! \"Saturdays\" and \"Sundays\" <u>are NOT \"business days</u>\".";
	$html_insert .= "</center>";
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	$html_insert .= "<span style='font-weight:normal;'>";
	$html_insert .= "...thank you for placing your <b><u>trust in ".$_SESSION['template']['company']['name']."</b></u>.";
	$html_insert .= "</span>";
	logger3("html_insert",$html_insert);
}



	

##########################################
################ CUSTOMER_SATISFACTION_POLL
##########################################

if($email_receipt == "customer_satisfaction_poll") {

	//logger3("test");
	
	
	$tmp_member = member($_SESSION['bonus']['customer_memberid']);
	
	$tmp_account = account($_SESSION['bonus']['customer_accountid']);
	
	$dear_who = pretty_member_name($tmp_member['memberid']);
	
	$send_to = $tmp_member['emailaddress'];
	
	### GET CREDIT CARD NUMBER
	//logger3("bonus['transactionid']",$_SESSION['bonus']['transactionid']);
	$tmp_deposit = source_deposit($_SESSION['bonus']['transactionid']);
	
	//logger3("tmp_deposit",$tmp_deposit);
	
	$tmp_method_details = explode("]['",$tmp_deposit['method_details']);
	
	$tmp_account_name = explode("^",$tmp_method_details[1]);
	$tmp_bank_name = explode("^",$tmp_method_details[2]);
	$tmp_account_number = explode("^",$tmp_method_details[3]);
	
	//$tmp_card = card_details($tmp_method_details['1']);
	
	
	//logger3("tmp_card",$tmp_card);
	
	
	### SET DEFAULT:
/*
	$email_card_text = "From " . $tmp_card['type'] . ":";
	$email_card_number = $tmp_card['display'];
	
	

	if($tmp_card['type'] == "VISA") {
		$email_card_text = "Charged VISA&trade;:";
	}
	
	
	if(strtolower($tmp_card['type']) == "mastercard") {
		$email_card_text = "Charged MasterCard&trade;:";
	}
*/
	
	
	$email_bank_name = $tmp_bank_name[1];
	$email_account_name = $tmp_account_name[1];
	$email_account_number = disguise_string($tmp_account_number[1],"4","right");


	
	$email_bonus_percentage = currency_format($_SESSION['bonus']['bonus_percentage'] * 100) . "%";
	
	
	$email_hash = $_SESSION['bonus']['hash'];
	

	$email_bonus_text = 	$_SESSION['bonus']['currency_0_code'] . "&nbsp;" . $_SESSION['bonus']['bonus_currency_0_value'];
	
	if( ($_SESSION['bonus']['currency_1_code']) && ($tmp_account['currency_translation'] == "On") && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_1_code']) ) {
		$email_bonus_text = $email_bonus_text . "<span style='font-weight:normal; font-size:smaller;'>&nbsp;&nbsp;(" . $_SESSION['bonus']['currency_1_code'] . "&nbsp;" . equals_symbol() . $_SESSION['bonus']['bonus_currency_1_value'] . ")</span>";
	}
		
	$tmp_amount_text = amount012DB($_SESSION['bonus']['transactionid']);
	$email_transaction_total = $tmp_amount_text['amount01'];
	
	
	$tmp_business_account = account($_SESSION['bonus']['business_accountid']);
	$email_business_name = strtoupper($tmp_business_account['accountname']);
	
	//logger3("tmp_member['memberid']",$tmp_member['memberid']);
	//logger3("bonus['datetime_created']",$_SESSION['bonus']['datetime_created']);
	
	
	$email_transaction_time = "<nobr>" . timezone($tmp_member['memberid'],$_SESSION['bonus']['datetime_created'],"day") . ", " . timezone($tmp_member['memberid'],$_SESSION['bonus']['datetime_created'],"goodlooking") . "</nobr>";
	
	$tmp_net_values = getTransactionNetValues($_SESSION['bonus']['transactionid']);

	$email_purchase_price = $tmp_net_values['0'];
	
	if( ($tmp_net_values['1']) && ($tmp_account['currency_translation'] == "On") && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_1_code']) ) { 
		$email_purchase_price .= "&nbsp;&nbsp;" . $tmp_net_values['1'];
	}
	
	if( ($tmp_net_values['2']) && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_2_code']) ) {
		$email_purchase_price .= "&nbsp;&nbsp;" . $tmp_net_values['2'];
	}
	
	//$tmp_platform_name = $_SESSION['template']['company']['domain'];

	$email_descriptive = strtoupper("(ALERT!)");
	//$dear_who = $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
	//$send_to = $_SESSION['member']['emailaddress'];
	
	$email_subject = "attn: " . $dear_who . " (Rate The Business: " . $email_business_name . ")";
	$text_insert = "TEXT";




	$html_insert = "<span style='font-size:17px; font-family:verdana; line-height:20px;'>
	<u>You recently purchased something from <b>" . $email_business_name . "</b></u>.
	" . $_SESSION['template']['company']['domain'] . " relies on your customer feedback to identify fraud and reward excellent service.
	<b>PLEASE TAKE A MOMENT TO \"<u>RATE\" THE SERVICE</u></b> YOU RECEIVED FROM:
	<span style='font-size:15px;'>
	<a href='https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "'><b><u>" . $email_business_name . "</u></b></a>&nbsp;&nbsp;&nbsp;<span style='font-size:14px;'>(<a href='https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "'>Click to <b>Rate This Business</b> & Get PAID!</a>)</span>
	</span>
	...or visit this URL:
	https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "
	<b>BONUS NOTICE:</b> " . $_SESSION['template']['company']['domain'] . " <i><b><u>will pay you " . $email_bonus_text . " to complete this customer satisfaction poll</u></b></i> -- just two questions -- <b>takes about 10 seconds</b>).
	<hr>
	<i>Additional Transaction Details:</i>
	<span style='font-weight:bold;'>Billed By:</span> <span style='color:#AA0000;'><b>\"WEBBILLING\"</b></span> (for <b>PayBySEPA.com</b>)
	<span style='font-weight:normal;'>Date of Transaction:</span> " . $email_transaction_time . "
	<span style='font-weight:normal;'>Vendor Name:</span>  " . $email_business_name . "
	<span style='font-weight:normal;'>Purchase Price:</span> " . $email_purchase_price . "
	<span style='font-weight:normal;'>Transaction Total:</span> " . $email_transaction_total . "
	<span style='font-weight:normal; color:#AA0000;'><i><b>Debiting from your</i></span> " . $email_bank_name . " &nbsp; Account Number: " . $email_account_number . "
	";

	logger3("html_insert",$html_insert);

}





##########################################
################ FIRST_CUSTOMER_SATISFACTION_POLL
##########################################


if($email_receipt == "first_customer_satisfaction_poll") {

	logger3("test");
	logger3("email_receipt",$email_receipt);	
	
	logger3("tmp_transaction",$tmp_transaction);
	
	$tmp_member = member($tmp_transaction['memberid']);
	
	logger3("tmp_member",$tmp_member);
	
	$tmp_account = account($tmp_transaction['accountid']);
	
	logger3("tmp_account",$tmp_account);
	
	$dear_who = pretty_member_name($tmp_member['memberid']);
	
	
	logger3("dear_who",$dear_who);
	
	$send_to = $tmp_member['emailaddress'];
	
	logger3("send_to",$send_to);
		
	### GET CREDIT CARD NUMBER
	logger3("bonus['transactionid']",$tmp_bonus['transactionid']);
	$tmp_deposit = source_deposit($tmp_transaction['transactionid']);
	
	logger3("tmp_deposit",$tmp_deposit);
	
		
	logger3("tmp_deposit['method_details']",$tmp_deposit['method_details']);
	
	$tmp_account_details = explode("][",$tmp_transaction['account_details']);
	
	logger3("tmp_account_details",$tmp_account_details);
	
	$tmp_business_account = account($tmp_account_details[1]);

	logger3("tmp_business_account",$tmp_business_account);


	
	$tmp_deposit_details = explode("][",$tmp_deposit['method_details']);
	
	logger3("tmp_deposit_details",$tmp_deposit_details);
	
	$tmp_account_name = explode("^",$tmp_deposit_details[1]);
	$tmp_bank_name = explode("^",$tmp_deposit_details[2]);
	$tmp_account_number = explode("^",$tmp_deposit_details[3]);
	
	
	
		
	
	
	
	
	logger3("tmp_account_number",$tmp_account_number);
	
	//$tmp_card = card_details($tmp_method_details['1']);
	
	
	logger3("tmp_card",$tmp_card);
	
	
	### SET DEFAULT:
/*
	$email_card_text = "From " . $tmp_card['type'] . ":";
	$email_card_number = $tmp_card['display'];
	
	

	if($tmp_card['type'] == "VISA") {
		$email_card_text = "Charged VISA&trade;:";
	}
	
	
	if(strtolower($tmp_card['type']) == "mastercard") {
		$email_card_text = "Charged MasterCard&trade;:";
	}
*/
	
	
	$email_bank_name = $tmp_bank_name[1];
	$email_account_name = $tmp_account_name[1];
	$email_account_number = disguise_string($tmp_account_number[1],"4","right");


	
	//$email_bonus_percentage = currency_format($tmp_bonus['bonus_percentage'] * 100) . "%";
	
	
	$email_hash = $tmp_bonus['hash'];
	

	//$email_bonus_text = 	$tmp_bonus['currency_0_code'] . "&nbsp;" . $tmp_bonus['bonus_currency_0_value'];
	
	//if( ($tmp_bonus['currency_1_code']) && ($tmp_account['currency_translation'] == "On") && ($tmp_bonus['currency_0_code'] != $tmp_bonus['currency_1_code']) ) {
		//$email_bonus_text = $email_bonus_text . "<span style='font-weight:normal; font-size:smaller;'>&nbsp;&nbsp;(" . $tmp_bonus['currency_1_code'] . "&nbsp;" . equals_symbol() . $tmp_bonus['bonus_currency_1_value'] . ")</span>";
	//}
		
	//$tmp_amount_text = amount012DB($tmp_bonus['transactionid']);
	//$email_transaction_total = $tmp_amount_text['amount01'];
	
	
	//$tmp_business_account = $tmp_business_account;
	$email_business_name = strtoupper($tmp_business_account['accountname']);
	
	logger3("email_business_name",$email_business_name);
	
	logger3("tmp_member['memberid']",$tmp_member['memberid']);
	logger3("bonus['datetime_created']",$tmp_bonus['datetime_created']);
	
	
	$email_transaction_time = "<nobr>" . timezone($tmp_member['memberid'],$tmp_transaction['requested_datetime'],"day") . ", " . timezone($tmp_member['memberid'],$tmp_transaction['requested_datetime'],"goodlooking") . "</nobr>";
	
	$tmp_net_values = getTransactionNetValues($tmp_transaction['transactionid']);
	logger3("tmp_net_values",$tmp_net_values);
	$email_purchase_price = $tmp_net_values['0'];
	
	if( ($tmp_net_values['1']) && ($tmp_account['currency_translation'] == "On") && ($tmp_bonus['currency_0_code'] != $tmp_bonus['currency_1_code']) ) { 
		$email_purchase_price .= "&nbsp;&nbsp;" . $tmp_net_values['1'];
	}
	
	if( ($tmp_net_values['2']) && ($tmp_bonus['currency_0_code'] != $tmp_bonus['currency_2_code']) ) {
		$email_purchase_price .= "&nbsp;&nbsp;" . $tmp_net_values['2'];
	}
	
	$tmp_platform_name = $_SESSION['template']['company']['domain'];

	//$email_descriptive = strtoupper("(ALERT!)");
	//$dear_who = $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
	//$send_to = $_SESSION['member']['emailaddress'];
	
	$email_insert_style = "
.link_to_poll {
	font-family:helvetica;
	font-size:20px;
	font-weight:bold;
	color:#AA0000;
	text-decoration:none;
}

.link_to_poll A {
	font-family:helvetica;
	font-size:20px;
	font-weight:bold;
	color:#AA0000;
	text-decoration:none;
}

.link_to_poll A:HOVER {
	font-family:helvetica;
	font-size:20px;
	font-weight:bold;
	color:#AA0000;
	text-decoration:underline;
}
";
	
	$email_subject = "attn: " . $dear_who . " (Rate The Business: " . strtoupper($tmp_business_account['accountname']) . ")";
	$send_from_postfix = " \(POLL\)";
	$text_insert = "TEXT";

logger3("_POST['rating']",$_POST['rating']);

$html_insert = "
<span style='font-size:14px; font-family:verdana; font-weight:normal; color:#444444;'>
You recently purchased something from <b>" . $tmp_business_account['accountname'] . "</b></u>:

<span style='font-size:12px; font-family:verdana; font-weight:normal; color:#222222;'>
<i>Transaction Details:</i>
<span style='font-weight:normal;'>Date of Transaction:</span> " . $email_transaction_time . "
<span style='font-weight:normal;'>Vendor Name:</span>  " . $email_business_name . "
<span style='font-weight:normal;'>Transaction Total:</span> " . $email_purchase_price . "
<span style='font-weight:normal; color:#AA0000;'><i><b>Debiting from your</i></span> &nbsp; <u>" . $email_bank_name . "</u> &nbsp; Account Number: " . $email_account_number . "
</span>

Please take just one moment... <a href='https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "'><span style='font-family:helvetica; font-size:20px; font-weight:bold; color:#AA0000; text-decoration:none;'>click here to <b>\"<u><i>RATE\" THIS BUSINESS NOW!!</i></u></span></a>*

</span>";


/*








<!--
<form method='post' action='https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "'>
<table style='width:550px; border-width:2px; border-style:ridge; border-color:#FF0000;'>
	<tr>
		<td style='padding:30px 30px 30px 30px; text-align:center;' colspan='4'>
			<nobr><span style='color:#000088; font-size:28px; font-weight:bold;'><u>" . $tmp_business_account['accountname'] . "</u></span></nobr>
		</td>

</tr><tr>
		<td style='padding:0px 30px 30px 30px; text-align:left;'>
			<nobr><span style='color:#990000; font-size:18px; font-weight:normal;'><b>Please <u>click to rate</u> <!-- <span style='font-size:20px;'>*</span> --> the business now:</b></span></nobr>
		</td>

</tr><tr>

		<td style='padding:10px 30px 30px 30px; text-align:right;'>
			<nobr><button type='submit' name='rating' value='excellent'><span style='font-size:18px; color:#000000;'><span style='font-size:12px; color:#666666;'><i>click here to rate <u>" . $tmp_business_account['accountname'] . "</u>:</i></span>&nbsp;&nbsp;<b>EXCELLENT</b> >></span></button></nobr>
		</td>

</tr><tr>

		<td style='padding:10px 30px 30px 30px; text-align:right;'>
			<nobr><button type='submit' name='rating' value='satisfactory'><span style='font-size:18px; color:#000000;'><span style='font-size:12px; color:#666666;'><i>click here to rate <u>" . $tmp_business_account['accountname'] . "</u>:</i></span>&nbsp;&nbsp;<b>SATISFACTORY</b> >></span></button></nobr>
		</td>

</tr><tr>

		<td style='padding:10px 30px 30px 30px; text-align:right;'>
			<nobr><button type='submit' name='rating' value='poor'><span style='font-size:18px; color:#000000;'><span style='font-size:12px; color:#666666;'><i>click here to rate <u>" . $tmp_business_account['accountname'] . "</u>:</i></span>&nbsp;&nbsp;<b>POOR</b> >></span></button></nobr>
		</td>


</tr>

<tr>
		<td style='padding:0px 30px 30px 30px; text-align:right; line-height:25px;'>
			<span style='color:#AA0000; font-size:16px; font-weight:normal; font-family:verdana;'>
				<b>!ALERT:</b>
				<i>INSTANT, One-Click VOTING!</i>
				<nobr>(One <u>vote per transaction</u> -- make it count!)</nobr>
			</span>
			
		</td>

</tr>


<tr>

		<td style='padding:5px 5px 5px 10px; text-align:left;'>
<span style='font-size:12px; font-family:verdana; font-weight:normal; line-height:25px;'>
<span style='font-size:20px;'>*</span>BONUS NOTICE: <b>" . $_SESSION['template']['company']['html_name'] . " <b> relies on your feedback</b> -- <i>so much</i> -- </b>that <u>we'll pay you " . $tmp_bonus['bonus_currency_0_value'] . " (".$_SESSION['template']['company']['currency1'].")</u> to complete the above customer satisfaction poll.
Tell us what you think of " . $tmp_business_account['accountname'] . " -- just click one of the above rating buttons, and  <b><u>" . $tmp_bonus['bonus_currency_0_value'] . " (".$_SESSION['template']['company']['currency1'].") will be instantly credited to your " . $_SESSION['template']['company']['domain'] . " Account!!!</b></span>
		</td>
	</tr>
	



</table>
</form>
-->

*/



$html_insert .= "
<span style='font-size:17px; font-family:verdana; font-weight:normal; color:#444444;'>
Alternatively, you may securely copy/paste this URL*:

<nobr>
	<a style='font-size:15px; font-family:helvetica; font-weight:bold; color:#008800;' href='https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "'>https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "</a>
	</nobr>

... into your web browser, to <i>rate " . $tmp_business_account['accountname'] . "</i> and receive your <span style='color:#6135A3;'><b><i>BONUS!</i></b></span>*

<span style='color:#AA0000;'><b>...just <u><i>ONE</i> question</u></b> -- fastest poll you will ever take!</span>

<center><i>(<u>We rely on your feedback</u> to keep our network clean.)</i></center>

<hr>
<span style='font-size:14px; font-family:verdana; font-weight:normal; line-height:25px;'>
<span style='font-size:24px;'>*</span><span style='color:#6135A3;'>BONUS NOTICE:</span> <b>" . $_SESSION['template']['company']['html_name'] . " <b> relies on your feedback</b> -- <i>so much</i> -- </b>that <u>we'll pay you " . $tmp_bonus['bonus_currency_0_value'] . " (".$_SESSION['template']['company']['currency1'].")</u> to complete the above customer satisfaction poll.
Tell us what you think of " . $tmp_business_account['accountname'] . " -- just click one of the above rating buttons, and  <b><u>" . $tmp_bonus['bonus_currency_0_value'] . " (".$_SESSION['template']['company']['currency1'].") will be instantly credited to your " . $_SESSION['template']['company']['domain'] . " Account!!!</b></span>
<hr>
<span style='line-height:45px; font-size:22px;'>
<i>Additional Transaction Details:</i>
</span>
<span style='line-height:25px;'>
<span style='font-weight:bold;'>Billed By:</span> <span style='color:#AA0000;'><b>\"WEBBILLING\"</b></span> (for <b>PayBySEPA.com</b>)
<span style='font-weight:normal;'>Date of Transaction:</span> " . $email_transaction_time . "
<span style='font-weight:normal;'>Vendor Name:</span>  " . $email_business_name . "
<span style='font-weight:normal;'>Transaction Total:</span> " . $email_purchase_price . "
<span style='font-weight:normal; color:#AA0000;'><i><b>Debiting from your</i></span> &nbsp; <u>" . $email_bank_name . "</u> &nbsp; Account Number: " . $email_account_number . "</span>";



logger3("html_insert",$html_insert);

}





##########################################
################ BONUS NOTICE (PBS/BANK) #
##########################################

if($email_receipt == "bonus_notice_bank_pbs") {

	//logger3("test");
	
	
	$tmp_member = member($_SESSION['bonus']['customer_memberid']);
	
	$tmp_account = account($_SESSION['bonus']['customer_accountid']);
	
	$dear_who = pretty_member_name($tmp_member['memberid']);
	
	$send_to = $tmp_member['emailaddress'];
	
	### GET CREDIT CARD NUMBER
	//logger3("bonus['transactionid']",$_SESSION['bonus']['transactionid']);
	$tmp_deposit = source_deposit($_SESSION['bonus']['transactionid']);
	
	//logger3("tmp_deposit",$tmp_deposit);
	
	$tmp_method_details = explode("]['",$tmp_deposit['method_details']);
	
	$tmp_account_name = explode("^",$tmp_method_details[1]);
	$tmp_bank_name = explode("^",$tmp_method_details[2]);
	$tmp_account_number = explode("^",$tmp_method_details[3]);
	
	//$tmp_card = card_details($tmp_method_details['1']);
	
	
	//logger3("tmp_card",$tmp_card);
	
	
	### SET DEFAULT:
/*
	$email_card_text = "From " . $tmp_card['type'] . ":";
	$email_card_number = $tmp_card['display'];
	
	

	if($tmp_card['type'] == "VISA") {
		$email_card_text = "Charged VISA&trade;:";
	}
	
	
	if(strtolower($tmp_card['type']) == "mastercard") {
		$email_card_text = "Charged MasterCard&trade;:";
	}
*/
	
	
	$email_bank_name = $tmp_bank_name[1];
	$email_account_name = $tmp_account_name[1];
	$email_account_number = disguise_string($tmp_account_number[1],"4","right");


	
	$email_bonus_percentage = currency_format($_SESSION['bonus']['bonus_percentage'] * 100) . "%";
	
	
	$email_hash = $_SESSION['bonus']['hash'];
	

	$email_bonus_text = 	$_SESSION['bonus']['currency_0_code'] . "&nbsp;" . $_SESSION['bonus']['bonus_currency_0_value'];
	
	if( ($_SESSION['bonus']['currency_1_code']) && ($tmp_account['currency_translation'] == "On") && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_1_code']) ) {
		$email_bonus_text = $email_bonus_text . "<span style='font-weight:normal; font-size:smaller;'>&nbsp;&nbsp;(" . $_SESSION['bonus']['currency_1_code'] . "&nbsp;" . equals_symbol() . $_SESSION['bonus']['bonus_currency_1_value'] . ")</span>";
	}
		
	$tmp_amount_text = amount012DB($_SESSION['bonus']['transactionid']);
	$email_transaction_total = $tmp_amount_text['amount01'];
	
	
	$tmp_business_account = account($_SESSION['bonus']['business_accountid']);
	$email_business_name = strtoupper($tmp_business_account['accountname']);
	
	//logger3("tmp_member['memberid']",$tmp_member['memberid']);
	//logger3("bonus['datetime_created']",$_SESSION['bonus']['datetime_created']);
	
	
	$email_transaction_time = "<nobr>" . timezone($tmp_member['memberid'],$_SESSION['bonus']['datetime_created'],"day") . ", " . timezone($tmp_member['memberid'],$_SESSION['bonus']['datetime_created'],"goodlooking") . "</nobr>";
	
	$tmp_net_values = getTransactionNetValues($_SESSION['bonus']['transactionid']);

	$email_purchase_price = $tmp_net_values['0'];
	
	if( ($tmp_net_values['1']) && ($tmp_account['currency_translation'] == "On") && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_1_code']) ) { 
		$email_purchase_price .= "&nbsp;&nbsp;" . $tmp_net_values['1'];
	}
	
	if( ($tmp_net_values['2']) && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_2_code']) ) {
		$email_purchase_price .= "&nbsp;&nbsp;" . $tmp_net_values['2'];
	}

	$email_descriptive = strtoupper("(ALERT!)");
	//$dear_who = $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
	//$send_to = $_SESSION['member']['emailaddress'];
	
	$email_subject = "attn: " . $dear_who . " (BONUS ISSUED:  Claim Your " . $email_bonus_percentage . " Account BONUS Now!)";
	$text_insert = "TEX";




	$html_insert = "<span style='font-size:17px; font-family:verdana; line-height:25px;'>
<span style='color:#444444;'><u>You have received a " . $email_bonus_percentage . " Account BONUS</u> resulting from the following transaction:</span>

<span style='font-weight:normal;'>Date of Transaction:</span> " . $email_transaction_time . "
<span style='font-weight:normal;'>Vendor Name:</span>  " . $email_business_name . "
<span style='font-weight:normal;'>Purchase Price:</span> " . $email_purchase_price . "

<span style='font-weight:normal;'>Transaction Total:</span> " . $email_transaction_total . "
<span style='font-weight:normal; color:#AA0000;'>Debited from your</span> " . $email_bank_name . " &nbsp; Account Number: " . $email_account_number . "
<span style='font-weight:normal;'>Billed By:</span> <span style='color:#AA0000;'>WEBBILLING</span> (for PayBySEPA.com)

<hr>
<span style='font-weight:normal; color:#008800;'>Account Bonus:</span> " . $email_bonus_percentage . "
<span style='font-weight:normal; color:#008800;'>Bonus Value:</span> " . $email_bonus_text . "
<hr>
<span style='color:#008800;'>To claim your Transaction BONUS, please visit this link:</span>

<span style='font-size:15px;'>
	<a href='https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "'>https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "</a>
</span>

You will be asked to complete a 10-second Customer Satisfaction Poll... simply \"rate\" the service you received from the vendor (\"seller\") to CLAIM YOUR TRANSACTION BONUS.";

logger3("html_insert",$html_insert);

}


##########################################
################ BONUS NOTICE (CC) #######
##########################################

if($email_receipt == "bonus_notice") {
	
	
	$tmp_member = member($_SESSION['bonus']['customer_memberid']);
	
	$tmp_account = account($_SESSION['bonus']['customer_accountid']);
	
	$dear_who = pretty_member_name($tmp_member['memberid']);
	
	$send_to = $tmp_member['emailaddress'];
	
	### GET CREDIT CARD NUMBER
	//logger3("bonus['transactionid']",$_SESSION['bonus']['transactionid']);
	$tmp_deposit = source_deposit($_SESSION['bonus']['transactionid']);
	
	//logger3("tmp_deposit",$tmp_deposit);
	
	$tmp_method_details = explode("]['",$tmp_deposit['method_details']);
	
	$tmp_card = card_details($tmp_method_details['1']);
	
	
	//logger3("tmp_card",$tmp_card);
	
	
	### SET DEFAULT:
	$email_card_text = "From " . $tmp_card['type'] . ":";
	$email_card_number = $tmp_card['display'];
	
	
	if($tmp_card['type'] == "VISA") {
		$email_card_text = "Charged VISA&trade;:";
	}
	
	
	if(strtolower($tmp_card['type']) == "mastercard") {
		$email_card_text = "Charged MasterCard&trade;:";
	}
	
	
	
	$email_bonus_percentage = number_format($_SESSION['bonus']['bonus_percentage'] * 100,1,".","") . "%";
	
	
	$email_hash = $_SESSION['bonus']['hash'];
	

	$email_bonus_text = 	$_SESSION['bonus']['currency_0_code'] . "&nbsp;" . $_SESSION['bonus']['bonus_currency_0_value'];
	
	if( ($_SESSION['bonus']['currency_1_code']) && ($tmp_account['currency_translation'] == "On") && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_1_code']) ) {
		$email_bonus_text = $email_bonus_text . "<span style='font-weight:normal; font-size:smaller;'>&nbsp;&nbsp;(" . $_SESSION['bonus']['currency_1_code'] . "&nbsp;" . equals_symbol() . $_SESSION['bonus']['bonus_currency_1_value'] . ")</span>";
	}
		
	$tmp_amount_text = amount012DB($_SESSION['bonus']['transactionid']);
	$email_transaction_total = $tmp_amount_text['amount01'];
	
	
	$tmp_business_account = account($_SESSION['bonus']['business_accountid']);
	$email_business_name = strtoupper($tmp_business_account['accountname']);
	
	//logger3("tmp_member['memberid']",$tmp_member['memberid']);
	//logger3("bonus['datetime_created']",$_SESSION['bonus']['datetime_created']);
	
	
	$email_transaction_time = timezone($tmp_member['memberid'],$_SESSION['bonus']['datetime_created'],"goodlooking");
	
	$tmp_net_values = getTransactionNetValues($_SESSION['bonus']['transactionid']);

	$email_purchase_price = $tmp_net_values['0'];
	if( ($tmp_net_values['1']) && ($tmp_account['currency_translation'] == "On") && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_1_code']) ) { 
		$email_purchase_price .= "&nbsp;&nbsp;" . $tmp_net_values['1'];
	}
	
	if( ($tmp_net_values['2']) && ($_SESSION['bonus']['currency_0_code'] != $_SESSION['bonus']['currency_2_code']) ) {
		$email_purchase_price .= "&nbsp;&nbsp;" . $tmp_net_values['2'];
	}

	$email_descriptive = strtoupper("(ALERT!)");
	//$dear_who = $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
	//$send_to = $_SESSION['member']['emailaddress'];
	
	$email_subject = "attn: " . $dear_who . " (BONUS ISSUED:  Claim Your " . $email_bonus_percentage . " Account BONUS Now!)";
	$text_insert = "TEXT";




	$html_insert = "<span style='font-size:17px; font-family:verdana; line-height:25px;'>
<span style='color:#444444;'>You have received a " . $email_bonus_percentage . " Account BONUS</u> resulting from the following transaction:<span>

Date of Transaction: " . $email_transaction_time . "
Vendor Name:  " . $email_business_name . "
Purchase Price: " . $email_purchase_price . "

Transaction Total: " . $email_transaction_total . "
" . $email_card_text . "&nbsp;&nbsp;" . $email_card_number . "

Account Bonus: " . $email_bonus_percentage . "
Bonus Value: " . $email_bonus_text . "

<span style='color:#AA0000;'><u>To claim your Transaction BONUS</u>, please visit this link:</span>

<a href='https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "'>https://" . $_SESSION['template']['company']['host_bonus'] . "/" . $send_to . "+" . $email_hash . "</a>

You will be asked to complete a 30-second Customer Satisfaction Poll (and \"rate\" the service you have received from the vendor (\"seller\").

</span>";

logger3("html_insert",$html_insert);

}


######################################################
################ ADMINISTRATIVE POLLING ALERT #######
######################################################

if($email_receipt == "administrative_polling_alert") {


	$email_descriptive = strtoupper("(ALERT!)");
	//$dear_who = $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
	$send_to = "support@vocabuy.com";
	
	$email_subject = "ADMIN ALERT: POLLING";
	$text_insert = "TEXT";

	$html_insert = "<p>
	POLL ID: " . $pollid . "
	";

}


################################################################################
################ PREFERENCE- SPONSOR DEPOSIT EMAIL: ##################################
################################################################################

if($email_receipt == "send_payment_request") {

	
	
	//$send_to = ""
	//$dear_who = "";
	//$transaction_timestamp = "";
	//" . $transaction_value . " = "";
	//$recipient_accountname
	
	$email_subject = "NOTICE: " . $transaction_value . " SPONSOR PAYMENT (FROM \"" . $_SESSION['account']['accountname'] . "\") Has Been Received";
	
	$text_insert = "
Account Activity:  " . $transaction_value . " SPONSOR PAYMENT (FROM \"" . $_SESSION['account']['accountname'] . "\") Has Been Received

Affected Account:  \"" . $recipient['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Timestamp: " . timezone($recipient['member']['memberid'],$transaction_timestamp,"goodlooking");  /// not quite right - businesses don't have timezone's -- 


	$html_insert = "

Account Activity:  " . $transaction_value . " SPONSOR PAYMENT (FROM \"" . $_SESSION['account']['accountname'] . "\") Has Been Received

Affected Account:  \"" . $recipient['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname']  . " " . $_SESSION['member']['lastname'] . "

Voice Authorization TIMESTAMP: " . timezone($recipient['member']['memberid'],$transaction_timestamp,"goodlooking");

}




################################################################################
################ PREFERENCE- SPONOR DEPOSIt EMAIL: ##################################
################################################################################

if($email_receipt == "email_sponsor_deposit") {

	
	
	//$send_to = ""
	//$dear_who = "";
	//$transaction_timestamp = "";
	//" . $transaction_value . " = "";
	//$recipient_accountname
	
	$email_subject = "NOTICE: " . $transaction_value . " SPONSOR PAYMENT (FROM \"" . $_SESSION['account']['accountname'] . "\") Has Been Received";
	
	$text_insert = "
Account Activity:  " . $transaction_value . " SPONSOR PAYMENT (FROM \"" . $_SESSION['account']['accountname'] . "\") Has Been Received

Affected Account:  \"" . $recipient['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Timestamp: " . timezone($recipient['member']['memberid'],$transaction_timestamp,"goodlooking");  /// not quite right - businesses don't have timezone's -- 


	$html_insert = "

Account Activity:  " . $transaction_value . " SPONSOR PAYMENT (FROM \"" . $_SESSION['account']['accountname'] . "\") Has Been Received

Affected Account:  \"" . $recipient['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname']  . " " . $_SESSION['member']['lastname'] . "

Voice Authorization TIMESTAMP: " . timezone($recipient['member']['memberid'],$transaction_timestamp,"goodlooking");

}





################################################################################
################ QUICKBUY CREDITCARD (SELLER): #################################
################################################################################

if($email_receipt == "quickbuy_creditcard_seller") {

	/* API:
	
	$email_receipt = ;
	$email_subject = ;
	
	$email_from_name = ;
	$email_reply_to_address = ;
	
	$send_to = ;
	$dear_who = ;
	
	######
	
	$transaction_value = ;
	
	
	$source_account_name = ;
	$source_member_name = ;

	$recipient_accountname = $recipient['account']['accountname'];
	$recipient_memberid = $recipient['member']['memberid'];
	$transaction_timestamp = $_SESSION['authorization']['timestamp'];
	
	*/

	### SET MULTI_CURRENCY
	
	if(
	(stristr($_SESSION['payme']['business']['account']['currency_translation'],"ON"))
	) {
		$transaction_value .= " (" . $_SESSION['payme']['currency']['business']['code'] . " " . currency_format($_SESSION['payme']['currency']['business']['amount'],",") . ") ";
	}
	
	
	$text_insert = "
Account Activity:  " . $transaction_value . " PAYMENT (FROM \"" . $source_account_name . "\")  ...has been received.

Affected Account:  \"" . $recipient_accountname . "\"

Initiated By:  " . $source_member_name . "

Approved Voice Authorization: " . datetime($transaction_timestamp) . " (+0/GMT)";


$html_insert = "";
$html_insert .= "<br>";
$html_insert .= "Account Activity:  ";
$html_insert .= "An INCOMING PAYMENT as been received.";
$html_insert .= "<br>";
$html_insert .= "PAYMENT FROM: <span style='font-weight:normal;'>" . $source_member_name . "</span>";
$html_insert .= "<br>";
$html_insert .= "AMOUNT:  <span style='font-weight:normal;'>" . $transaction_value . "</span>";
$html_insert .= "<br>";
$html_insert .= "Voice Authorization TIMESTAMP: <span style='font-weight:normal;'>" . datetime($transaction_timestamp) . " (+0/GMT)</span>";
$html_insert .= "<br>";
}








################################################################################
################ QUICKBUY CREDITCARD (BUYER): ##################################
################################################################################

if($email_receipt == "quickbuy_creditcard_buyer") {

	/* API:
	
	$email_receipt = ;
	$email_subject = ;
	
	$email_from_name = ;
	$email_from_address = 
	
	$send_to = ;	
	$dear_who = ;

	$transaction_value = ;
	$recipient_accountname = ;

	$transaction_timestamp =;
	$transaction_hash = ;
	

	*/
	
	
	if(
	(!stristr($_SESSION['payme']['customer']['account']['currency_translation'],"OFF"))
	) {
	    $transaction_value .= " (" . $_SESSION['payme']['currency']['customer']['code'] . " " . currency_format($_SESSION['payme']['currency']['customer']['total'],",") . ") ";
	}
	
	
	
	$text_insert = "
Account Activity:  " . $transaction_value . " RECEIPT | COMPLETED PAYMENT TO \"" . $recipient_accountname . "\"

Affected Account:  \"" . $source_accountname . "\"

Initiated By:  " . $source_accountname . "

Approved Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");

	$html_insert .= "<br>";
	$html_insert .= "Account Activity:";
	$html_insert .= "&nbsp;&nbsp;<u>";
	$html_insert .= $transaction_value . " RECEIPT</u>";
	$html_insert .= "<br>";
	$html_insert .= "PAYMENT TO: <span style='font-weight:normal;'>" . $recipient_accountname . "</span>";
	$html_insert .= "<br>";
	$html_insert .= "Initiated By:  <span style='font-weight:normal;'>";
	$html_insert .= $source_accountname;
	$html_insert .= "</span><br>";	
	$html_insert .= "Voice Authorization TIMESTAMP: <span style='font-weight:normal;'>" . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
	$html_insert .= "</span><br>";	

}







################################################################################
################ PAYBYSEPA (BUYER): ##################################
################################################################################

if($email_receipt == "paybysepa_buyer") {

	
	$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	//" . $transaction_value . " = "";
	//$recipient_accountname
	
	$email_subject = "RECEIPT: " . $transaction_value . " PAYMENT (TO \"" . $recipient_accountname . "\") Has Been Approved";
	
	$text_insert = "
Account Activity:  " . $transaction_value . " PAYMENT (TO \"" . $recipient_accountname . "\") Has Been Approved

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];

if(
(!stristr($_COOKIE['cookie_route'],"HIDE SECRETS")) &&
(!stristr($_SESSION['route'],"HIDE SECRETS"))
) {
	$text_insert .= "

Approved Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
}

$text_insert .= "

NOTE:  Your Bank Account Statement will show a debit by WEBBILLING.COM, in association with PayBySEPA.com.";


$html_insert = "

Account Activity:  " . $transaction_value . " PAYMENT (TO \"" . $recipient_accountname . "\") Has Been Approved

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];

if(
(!stristr($_COOKIE['cookie_route'],"HIDE SECRETS")) &&
(!stristr($_SESSION['route'],"HIDE SECRETS"))
) {
	$html_insert .= "
	
	Voice Authorization TIMESTAMP: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
}

$html_insert .= "

NOTE:  Your Bank Account Statement will show a debit by <u>WEBBILLING.COM</u>, in association with <u>PayBySEPA.com</u>.";

}



################################################################################
################ DEPOSIT CREDITCARD: ###########################################
################################################################################

if($email_receipt == "deposit_creditcard") {

	
	$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	//" . $transaction_value . " = ""
	
	$email_subject = "RECEIPT: " . $transaction_value . " DEPOSIT Has Been Approved";
	
	$text_insert = "
Account Activity:  " . $transaction_value . " DEPOSIT Has Been Approved

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Voice Authorization TIMESTAMP: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");


	$html_insert = "<br>

Account Activity:  <b>" . $transaction_value . " DEPOSIT Has Been Approved</u></b><br>

Affected Account:  <b>\"" . $_SESSION['account']['accountname'] . "\"</b><br>

Initiated By:  <b>" . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "</b><br>

Approved Voice Authorization: <b>" . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking") . "</b><br>";

}











################################################################################
################ EDIT PASSWORD: ###########################################
################################################################################

if($email_receipt == "edit_password") {

	
	$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "RECEIPT: Your Universal Membership Password Has Been Edited";
	
	$text_insert = "
Account Activity:  Your Universal Membership Password Has Been Edited

Affected Account:  (This affects your " . $_SESSION['template']['company']['name'] . " membership login password.)

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Approved Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");


	$html_insert = "

Account Activity:  Your Universal Membership Password Has Been Edited

Affected Account:  (This affects your " . $_SESSION['template']['company']['name'] . " membership login password.)

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Voice Authorization TIMESTAMP: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");

}











################################################################################
################ EDIT EMAIL ADDRESS: ###########################################
################################################################################

if($email_receipt == "edit_email_address") {

	
	$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "RECEIPT: Your Account (Routing) Email Address Has Been Edited";
	
	$text_insert = "
Account Activity:  Your Account (Routing) Email Address Has Been Edited

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Approved Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");


	$html_insert = "

Account Activity:  Your Account (Routing) Email Address Has Been Edited

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Voice Authorization TIMESTAMP: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");

}







################################################################################
################ EDIT IDENTITY: ###############################################
################################################################################

if($email_receipt == "edit_identity") {

	
	$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "RECEIPT: Your Identity Has Been Edited";
	
	$text_insert = "
Account Activity:  Your Account Identity Has Been Edited

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Approved Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");


	$html_insert = "

Account Activity:  Your Account Identity Has Been Edited

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Voice Authorization TIMESTAMP: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");

}


################################################################################
################ personalize_payment_page: ###############################################
################################################################################

if($email_receipt == "personalize_payment_page") {

	
	$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "RECEIPT: Updated Payment-Page Personalization";
	
	$text_insert = "
Account Activity:  Your Payment-Page Personalization has been Updated.

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Approved Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");


	$html_insert = "

Account Activity:  Your Payment-Page Personalization has been Updated.

Affected Account:  \"" . $_SESSION['account']['accountname'] . "\"

Initiated By:  " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "

Voice Authorization TIMESTAMP: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");

}




################################################################################
################ PASSWORD REMINDER: ############################################
################################################################################

if($email_receipt == "password_reminder") {

	
	//$send_to = $send_to;	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "NOTICE: Password Reminder";
	
	$text_insert = "
Account Activity:  Password Reminder

Account Password:  \"" . $password_reminder . "\"";


	$html_insert = "

Account Activity:  Password Reminder

Account Password:  \"" . $password_reminder . "\"";

}


################################################################################
### SET: email_receipt_biometric_security_version
################################################################################
$email_receipt_biometric_security_version = true;
if(stristr($_SESSION['template']['company']['name'], "VIDEO-CONFERENCE.LINK")) $email_receipt_biometric_security_version = false;
################################################################################


################################################################################
################ REGISTRATION (BUSINESS): ######################################
################################################################################

if($email_receipt == "registration_business") {

	//test("email_receipts: email_receipt",$email_receipt);

	if($_SESSION['session']['registration_business']['admin'] == TRUE) {
		
		$send_to = $_SESSION['session']['registration_business']['emailaddress'];
		$tmp_account_name = $_SESSION['authorization']['business_name'] . " " . $_SESSION['authorization']['business_type'];
		$tmp_member = member($memberid);
		$initiated_by = $tmp_member['salutation'] . " " . $tmp_member['firstname'] . " " . $tmp_member['lastname'];

		
	} else {
		
		$send_to = $_SESSION['member']['emailaddress'];
		$tmp_account_name = $_SESSION['account']['accountname'];
		$initiated_by = $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
		
		
		
	}
	
	//test("set_receipt_emailaddress",$set_receipt_emailaddress);
	//test("send_to",$send_to);
	$send_to = trim($send_to);
	if(empty($send_to)) {
		if(!empty($set_receipt_emailaddress)) {
			$send_to = $set_receipt_emailaddress;
		}
	}
	//test("zzz_send_to",$send_to);
	
	
	
	
	$tmp_account_name = trim($tmp_account_name);
	//test("_SESSION['voice_authorization_api']['business_account_details']",$_SESSION['voice_authorization_api']['business_account_details']);
	
	//if("https://images.vocaone.com/". $_SESSION['voice_authorization_api']['business_account_details']);
	
	if(empty($tmp_account_name)) {
		
		if(is_array($_SESSION['voice_authorization_api']['business_account_details'])) {
			$tmp_account_name = $_SESSION['voice_authorization_api']['business_account_details']['accountname'];
		}
		
		if(!empty($_SESSION['voice_authorization_api']['business_account_details']['accountname'])) {
			$tmp_account_name .= " ". $_SESSION['voice_authorization_api']['business_account_details']['business_type'];
		}
	}
	
	
	if(!empty($tmp_account_name)) {
		$email_subject = "RECEIPT: \"" . $tmp_account_name . "\" Business Account Has Been Approved";
		$text_subject = "\"" . $tmp_account_name . "\" Business Account Has Been Approved";
	} else {
		$email_subject = "RECEIPT: Your ". $_SESSION['template']['company']['text_name'] ." Account Has Been Approved";
		$text_subject = "Your Account Has Been Approved";
	}
	
	
	

	
	
	
	$text_insert = "
	Account Activity:  ". $text_subject ."!

	Initiated By:  " . $initiated_by;


	$email_receipt_biometric_security_version = false;

	if(
	($email_receipt_biometric_security_version != false) &&
	($_SESSION['session']['registration_business']['admin'] != TRUE)
	) {
		
		$text_insert .= "Approved Voice Authorization: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
		
	}


	$html_insert = "";
	$html_insert .= "Account Event:";
	$html_insert .= $text_subject ."!";
	$html_insert .= "<br>";
	$html_insert .= "Initiated By:  " . $initiated_by;
	$html_insert .= "<br>";


	if(
	($_SESSION['session']['registration_business']['admin'] != TRUE) &&
	($email_receipt_biometric_security_version == true)
	) {
		$html_insert .= "Voice Authorization TIMESTAMP: " . timezone($_SESSION['member']['memberid'],$transaction_timestamp,"goodlooking");
	}




}

//test("send_to",$send_to);



################################################################################
################ REGISTRATION (BUSINESS) PHOTO.BANGK!: ######################################
################################################################################

if($email_receipt == "registration_business_photobangk") {

	//test("email_receipts: email_receipt",$email_receipt);

	if($_SESSION['session']['registration_business']['admin'] == TRUE) {
		
		$send_to = $_SESSION['session']['registration_business']['emailaddress'];
		$tmp_account_name = $_SESSION['authorization']['business_name'] . " " . $_SESSION['authorization']['business_type'];
		$tmp_member = member($memberid);
		$initiated_by = $tmp_member['salutation'] . " " . $tmp_member['firstname'] . " " . $tmp_member['lastname'];

		
	} else {
		
		$send_to = $_SESSION['member']['emailaddress'];
		$tmp_account_name = $_SESSION['account']['accountname'];
		$initiated_by = $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
		
		
		
	}
	
	//test("set_receipt_emailaddress",$set_receipt_emailaddress);
	//test("send_to",$send_to);
	$send_to = trim($send_to);
	if(empty($send_to)) {
		if(!empty($set_receipt_emailaddress)) {
			$send_to = $set_receipt_emailaddress;
		}
	}
	//test("zzz_send_to",$send_to);
	
	
	
	
	$tmp_account_name = trim($tmp_account_name);
	//test("_SESSION['voice_authorization_api']['business_account_details']",$_SESSION['voice_authorization_api']['business_account_details']);
	
	//if("https://images.vocaone.com/". $_SESSION['voice_authorization_api']['business_account_details']);
	
	if(empty($tmp_account_name)) {
		
		if(is_array($_SESSION['voice_authorization_api']['business_account_details'])) {
			$tmp_account_name = $_SESSION['voice_authorization_api']['business_account_details']['accountname'];
		}
		
		if(!empty($_SESSION['voice_authorization_api']['business_account_details']['accountname'])) {
			$tmp_account_name .= " ". $_SESSION['voice_authorization_api']['business_account_details']['business_type'];
		}
	}
	
	
	if(!empty($tmp_account_name)) {
		$email_subject = "RECEIPT: \"" . $tmp_account_name . "\" Business Account Has Been Approved";
		$text_subject = "\"" . $tmp_account_name . "\" Business Account Has Been Approved";
	} else {
		$email_subject = "RECEIPT: Your ". $_SESSION['template']['company']['text_name'] ." Account Has Been Approved";
		$text_subject = "Your Account Has Been Approved";
	}
	
	
	

	
	$email_subject = "Welcome to ". $_SESSION['template']['company']['host_photo'] ." (New Account Information)";
	
$text_insert = "
Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",

Welcome to photo." . $_SESSION['template']['company']['name'] . ".

https://LOGIN." . $_SESSION['template']['company']['domain'];



$text_insert .= "

If you need further assistance, please contact our courteous customer support staff.";

if($email_receipt_biometric_security_version == true) {
	$text_insert .= "
	
	Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".";
}


$text_insert .= "

We look forward to serving you.

Sincerely,

" . $_SESSION['template']['company']['name'] . " Support Staff
" . $_SESSION['template']['company']['emailaddress_support'] . "
https://" . $_SESSION['template']['company']['host_support'] . "


";


$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
<b>Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",<br>
<br>
Welcome to ". $_SESSION['template']['company']['host_photo'] ."!</b>.<br>
<br>
". $_SESSION['template']['company']['host_photo'] ." has been designed for professional and passionate photographers, who are looking to (securely) <u>store and profit</u> from their digital (photo) assets.<br>
<br>
Within 15 minutes, you can be uploading photos to your <u>unique, personalized gallery</u>:<ul>
<li>using your own logo;</li>
<li>choosing your own \"warehouse\" theme;</li>
<li>selecting your own watermark branding;</li>
<li>setting your own prices</li>
</ul>
...and <b>monetizing your creative, digital assets!</b>
<hr>
<br>
<b>Here is the link to your public photo gallery:</b><br>
<br>
<a href='". $gallery_URL ."' target='_" . $_SESSION['template']['company']['host_photo'] . "'>". $gallery_URL ."</a><br>
<br>
Give this link to your friends and clients. (Visitors can search your online gallery by Portfolio and/or Key Words.)<br>
<br>
To edit/update your gallery, click the (Administrative) 'LOG-IN' link (located: upper left of your public gallery page).<br>
<br>
<b>Welcome to the e-business revolution...</b><br>
<br>
Welcome to <b><a href='https://". $_SESSION['template']['company']['host_photo'] ."' target='_" . $_SESSION['template']['company']['host_photo'] . "'>". $_SESSION['template']['company']['host_photo'] ."</a></b><br>
";


$html_insert .= "<br>
If you need further assistance, please contact our courteous customer support staff.<br>
<br>";



$html_insert .= "
We look forward to serving you.<br>
<br>
Sincerely,<br>
<br>
" . $_SESSION['template']['company']['name'] . " Support Staff<br>
" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>

";


$final_email_message = "yes";




}






################################################################################
################ registration_general_photoBLAST: ######################################
################################################################################

if($email_receipt == "registration_general_photoBLAST") {

	//test("email_receipts: email_receipt",$email_receipt);

	if($_SESSION['session']['registration_business']['admin'] == TRUE) {
		
		$send_to = $_SESSION['session']['registration_business']['emailaddress'];
		$tmp_account_name = $_SESSION['authorization']['business_name'] . " " . $_SESSION['authorization']['business_type'];
		$tmp_member = member($memberid);
		$initiated_by = $tmp_member['salutation'] . " " . $tmp_member['firstname'] . " " . $tmp_member['lastname'];

		
	} else {
		
		$send_to = $_SESSION['member']['emailaddress'];
		$tmp_account_name = $_SESSION['account']['accountname'];
		$initiated_by = $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'];
		
		
		
	}
	
	//test("set_receipt_emailaddress",$set_receipt_emailaddress);
	//test("send_to",$send_to);
	$send_to = trim($send_to);
	if(empty($send_to)) {
		if(!empty($set_receipt_emailaddress)) {
			$send_to = $set_receipt_emailaddress;
		}
	}
	//test("zzz_send_to",$send_to);
	
	
	
	
	$tmp_account_name = trim($tmp_account_name);
	//test("_SESSION['voice_authorization_api']['business_account_details']",$_SESSION['voice_authorization_api']['business_account_details']);
	
	//if("https://images.vocaone.com/". $_SESSION['voice_authorization_api']['business_account_details']);
	
	if(empty($tmp_account_name)) {
		
		if(is_array($_SESSION['voice_authorization_api']['business_account_details'])) {
			$tmp_account_name = $_SESSION['voice_authorization_api']['business_account_details']['accountname'];
		}
		
		if(!empty($_SESSION['voice_authorization_api']['business_account_details']['accountname'])) {
			$tmp_account_name .= " ". $_SESSION['voice_authorization_api']['business_account_details']['business_type'];
		}
	}
	
	
	$email_subject = $_SESSION['template']['company']['host_photo'] ." Camera App Details (Welcome!)";
	$text_subject = $_SESSION['template']['company']['host_photo'] ." Camera App Details (Welcome!)";
	
	
	
	

$text_insert = "
Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",

Welcome to ". $_SESSION['template']['company']['host_photo'] .".

https://". $_SESSION['template']['company']['host_login'];



$text_insert .= "

If you need further assistance, please contact our courteous customer support staff.";

if($email_receipt_biometric_security_version == true) {
	$text_insert .= "
	
	Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".";
}


$text_insert .= "

We look forward to serving you.

Sincerely,

" . $_SESSION['template']['company']['name'] . " Support Staff
" . $_SESSION['template']['company']['emailaddress_support'] . "
https://" . $_SESSION['template']['company']['host_support'] . "


";


$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
<b>Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",</b><br>
<br>
Thank you for downloading / installing the <b>". $_SESSION['template']['company']['host_photo'] ." Camera</b> App, <u>w/ PaparaZ Mode</u><sup>&trade;</sup> !!!<br>
<br>
The ". $_SESSION['template']['company']['host_photo'] ." camera provides:<ul>
<li><b>Auto-Watermarking</b> & Branding of your photos.</li>
<li><b>Gallery storage</b> (w/ FREE \"space\" for 100 photos!)</li>
<li><b>Online monetization</b> tools.</li>
</ul>
Every time you take a photo (or select an existing photo) with the ". $_SESSION['template']['company']['host_photo'] ." Camera App, you are given the opportunity to:<ul>
<li>Upload the photo to your gallery; set watermarks & prices; then broadcast your photo to multiple social networks (to actively monetize your digital assets)</li>
- OR -<br>
<li>Upload the photo to your gallery; then set watermarks & prices (to passively monetize your digital assets).</li>
</ul>
<hr>
<br>
With the ". $_SESSION['template']['company']['host_photo'] ." Camera App you can now: <b>Shoot, Upload, Store, and Sell</b> your photos!<br>
<br>
<hr>
<br>
You will notice a link to your Gallery on your App. screen. Before you share this Gallery with friends and associates, we encourage you to <span style='#color:#CC0000;'><b>customize your \"warehouse theme\"!</b></span><br>
<br>
Please note: Your gallery is best viewed with a desktop or laptop.<br>
<br>
From your desktop or laptop:<ol>
<li>Go to https://". $_SESSION['template']['company']['host_login'] ."</li>
<li>Sign in with the same email address that you used to download the ". $_SESSION['template']['company']['host_photo'] ." Camera App. (Personal Login Account ID)</li>
<li>Enter/establish the password you wish to use for this account. (Personal Login Password)</li>
<li>Click the \"Click to Login\" button.</li>
<li>Then follow the \"Hello & Welcome\" message/instructions!</li>
</ol>
Now customize your new gallery:<ol>
<li>Upload a logo!</li>
<li>Click the \"Edit Gallery Theme\" button!</li>
<li>Have fun creating your new space!</li>
<li>Be sure to \"LOG-OFF\" before you leave.</li>
</ol>
Thank you (again) for downloading / installing the ". $_SESSION['template']['company']['host_photo'] ." Camera App.<br>
<br>
<h3>The ". $_SESSION['template']['company']['host_photo'] ." Camera App streamlines the Shoot. Upload. Sell. process.</h3>
<br>
We hope you enjoy your new \"enhanced camera\" and your new online photo gallery!<br>
<br>
If you need further assistance, please contact our courteous customer support staff.<br>
<br>
";


$html_insert .= "
We look forward to serving you.<br>
<br>
Sincerely,<br>
<br>
" . $_SESSION['template']['company']['name'] . " Support Staff<br>
" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>

";


$final_email_message = "yes";




}





################################################################################
################ registration_general_PAYYAP: ######################################
################################################################################

if($email_receipt == "registration_general_PAYYAP") {

	//test("email_receipts: email_receipt",$email_receipt);

	if($_SESSION['session']['registration_business']['admin'] == TRUE) {
		
		$send_to = $_SESSION['session']['registration_business']['emailaddress'];
		$tmp_account_name = $_SESSION['authorization']['business_name'] . " " . $_SESSION['authorization']['business_type'];
		$tmp_member = member($memberid);
		$initiated_by = $tmp_member['salutation'] . " " . $tmp_member['firstname'] . " " . $tmp_member['lastname'];

		
	} else {
		
		$send_to = $_SESSION['member']['emailaddress'];		
	}
	
	
	
		
	$email_subject = "PAYYAP  Details (Welcome!)";
	$text_subject = "PAYYAP Details (Welcome!)";
	
	
	
	

$text_insert = "
Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",

Welcome to photo." . $_SESSION['template']['company']['name'] . ".

https://LOGIN." . $_SESSION['template']['company']['domain'];



$text_insert .= "

If you need further assistance, please contact our courteous customer support staff.";

if($email_receipt_biometric_security_version == true) {
	$text_insert .= "
	
	Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".";
}


$text_insert .= "

We look forward to serving you.

Sincerely,

" . $_SESSION['template']['company']['name'] . " Support Staff
" . $_SESSION['template']['company']['emailaddress_support'] . "
https://" . $_SESSION['template']['company']['host_support'] . "


";


$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
<b>Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",</b><br>
<br>
Thank you for downloading / installing <b>PAYYAP</b> - The Payments App&trade;<br>
<br>
PAYYAP is the easiest way to take a AMEX/MC/Visa payment (face-to-face or over the phone) <b><i>in realtime!</i></b><br>
<br>
If you need further assistance, please contact our courteous customer support staff.<br>
<br>
";


$html_insert .= "
We look forward to serving you.<br>
<br>
Sincerely,<br>
<br>
" . $_SESSION['template']['company']['name'] . " Support Staff<br>
" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>

";


$final_email_message = "yes";




}















//test("send_to",$send_to);


################################################################################
################ REGISTRATION (PERSONAL): ######################################
################################################################################

if($email_receipt == "registration_personal") {

	
	
		
		if(!$send_to) $send_to = $_SESSION['member']['emailaddress'];	
		//$dear_who = "";
		//$transaction_timestamp = "";
		
		$email_subject = "RECEIPT:  Welcome " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "...!";
		
	$text_insert = "
	Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",
	
	Welcome to " . $_SESSION['template']['company']['name'] . ".
	
	https://LOGIN." . $_SESSION['template']['company']['domain'];
	
	
	
	$text_insert .= "
	
	If you need further assistance, please contact our courteous customer support staff.";
	
	if($email_receipt_biometric_security_version == true) {
		$text_insert .= "
		
		Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".";
	}
	
	
	$text_insert .= "
	
	We look forward to serving you.
	
	Sincerely,
	
	" . $_SESSION['template']['company']['name'] . " Support Staff
	" . $_SESSION['template']['company']['emailaddress_support'] . "
	https://" . $_SESSION['template']['company']['host_support'] . "
	
	
	";
	
	
	$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
	<b>Dear " . $dear_who . ",</b><br>
	<br>
	Welcome to the " . $_SESSION['template']['company']['name'] . " Online Business Community&trade;<br>
	<br>
	Now that you are a member of the " . $_SESSION['template']['company']['name'] . " community, you have full and free access to a powerful basket of business services, including:<ul>
	<li>Global VPN (Virtual Private Network)</li>
	<li>Email & Telecommunications</li>
	<li>CRM Tools</li>
	<li>Google-Indexed Business Profiles</li>
	<li>Full-Serviced Payments (AMEX/MC//VISA)</li><ul>
	<li>Pay Buttons, Shopping Carts & API Options</li>
	<li>Instant, Online Approval for Most International Businesses</li>
	<li>Weekly Remittance to Any International Bank Account.</li>
	</ul>
	</ul>
	<br>
	Within 15 minutes... you can be contacting your clients & completing online sales.
	<br>
	<b>Welcome to the e-business revolution....</b><br>
	<br>
	Welcome to <b>" . $_SESSION['template']['company']['name'] . "</b> - " . $_SESSION['template']['company']['slogan_1'] . "<br>
	<br>
	You may please LOG-IN to your account any time:<br>
	<br>
	https://LOGIN." . $_SESSION['template']['company']['domain'] . "<br>
	<br>
	";
	
	
	$html_insert .= "
	If you need further assistance, please contact our courteous customer support staff.<br>
	<br>";
	
	
	
	$html_insert .= "
	We look forward to serving you.<br>
	<br>
	Sincerely,<br>
	<br>
	" . $_SESSION['template']['company']['name'] . " Support Staff<br>
	" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
	<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>
	
	";
	
	
	$final_email_message = "yes";
	
		
	### 	$send_to = $_SESSION['member']['emailaddress'];	
	### 	//$dear_who = "";
	### 	//$transaction_timestamp = "";
	### 	
	### 	$email_subject = "RECEIPT:  Welcome " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "...!";
	### 	
	### $text_insert = "
	### Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",
	### 
	### Welcome to " . $_SESSION['template']['company']['name'] . ".
	### 
	### https://LOGIN." . $_SESSION['template']['company']['domain'];
	### 
	### if($email_receipt_biometric_security_version == true) {
	### 	$text_insert .= "
	### 	
	### 	As you have experienced, " . $_SESSION['template']['company']['name'] . " offers our account holders unprecedented online security!
	### 	
	### 	Our biometrically infused, automated voice authorization process (which you will see during the standard LOGIN process) insures that YOU (and only you) can access and administer your account.";
	### }
	### 
	### $text_insert .= "
	### 
	### If you need further assistance, please contact our courteous customer support staff.";
	### 
	### if($email_receipt_biometric_security_version == true) {
	### 	$text_insert .= "
	### 	
	### 	Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".";
	### }
	### 
	### 
	### $text_insert .= "
	### 
	### We look forward to serving you.
	### 
	### Sincerely,
	### 
	### " . $_SESSION['template']['company']['name'] . " Support Staff
	### " . $_SESSION['template']['company']['emailaddress_support'] . "
	### https://" . $_SESSION['template']['company']['host_support'] . "
	### 
	### 
	### ";
	### 
	### 
	### $html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;'>
	### <b>Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",</b><br>
	### <br>
	### Welcome to " . $_SESSION['template']['company']['name'] . ".<br>
	### <br>
	### https://LOGIN." . $_SESSION['template']['company']['domain'] . "<br>";
	### 
	### if($email_receipt_biometric_security_version) {
	### 	$html_insert .= "
	### 	<br>
	### 	As you have experienced, " . $_SESSION['template']['company']['name'] . " offers account holders <u>unprecedented online security</u>!<br>
	### 	<br>
	### 	Our biometrically infused, automated voice authorization process (which you will see during the standard LOGIN process) insures that YOU (and only you) can access and administer your account.<br>
	### 	<br>";
	### }
	### 
	### $html_insert .= "
	### If you need further assistance, please contact our courteous customer support staff.<br>
	### <br>";
	### 
	### if($email_receipt_biometric_security_version) {
	### 	$html_insert .= "
	### 	Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".<br>
	### 	<br>";
	### }
	### 
	### $html_insert .= "
	### We look forward to serving you.<br>
	### <br>
	### Sincerely,<br>
	### <br>
	### " . $_SESSION['template']['company']['name'] . " Support Staff<br>
	### " . $_SESSION['template']['company']['emailaddress_support'] . "<br>
	### <a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>
	### 
	### ";
	### 
	### 
	### $final_email_message = "yes";


}





################################################################################
################ REGISTRATION (PERSONAL) PHOTO.BANGK!: ######################################
################################################################################

if($email_receipt == "registration_personal_photobangk") {


	
	$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "ACCOUNT RECEIPT:  Welcome " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . "...!";
	
$text_insert = "
Dear " . $_SESSION['member']['salutation'] . " " . $_SESSION['member']['firstname'] . " " . $_SESSION['member']['lastname'] . ",

Welcome to " . $_SESSION['template']['company']['name'] . ".

https://" . $_SESSION['template']['company']['host_login'];



$text_insert .= "

If you need further assistance, please contact our courteous customer support staff.";

if($email_receipt_biometric_security_version == true) {
	$text_insert .= "
	
	Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".";
}


$text_insert .= "

We look forward to serving you.

Sincerely,

" . $_SESSION['template']['company']['name'] . " Support Staff
" . $_SESSION['template']['company']['emailaddress_support'] . "
https://" . $_SESSION['template']['company']['host_support'] . "


";


$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
<b>Dear " . $dear_who . ",<br>
<br>
<b>Welcome to the eBusiness revolution...</b><br>
<br>
Welcome to <u>" . $_SESSION['template']['company']['host_photo'] . "</u><sup>&trade;</sup>!<br>
<hr>
<br>
To access your gallery via your \"master\" " . $_SESSION['template']['company']['host_photo'] . " Account:<ol>
	<li>Go to <a href='https://" . $_SESSION['template']['company']['host_photo'] . "' target='_" . $_SESSION['template']['company']['host_photo'] . "'>" . $_SESSION['template']['company']['host_photo'] . "</a></li>
	<li>Click the \"LOG-IN\" button (located: upper right of home page).</li>
	<li>Enter your registered personal e-mail address and password</li>
	<li>Click to LOG-IN</li>
</ol>
You will be taken to the \"Main Menu\" ...then, under <b>BUSINESS SERVICES</b>, find <span style='color:#CC0000;'>\"professional gallery\"</span>, and click on the link entitled: <a href='https://" . $_SESSION['template']['company']['host_photo'] . "/". $tmp_account_details['emailaddress'] ."' disabled>\"<b>" . $_SESSION['template']['company']['host_photo'] . "</b>/". $tmp_account_details['emailaddress'] ."</a>\".
<br>
";


$html_insert .= "
If you need further assistance, please contact our courteous customer support staff.<br>
<br>";



$html_insert .= "
We look forward to serving you.<br>
<br>
Sincerely,<br>
<br>
" . $_SESSION['template']['company']['name'] . " Support Staff<br>
" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>

";


$final_email_message = "yes";


}







################################################################################
################ photobank_newaccount_followup_1 ###############################
################################################################################

if($email_receipt == "photobank_newaccount_followup_1") {


	
	//$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "Getting Started with " . $_SESSION['template']['company']['host_photo'] . "!";
	
	$text_insert = "";


$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
<b>Dear " . $dear_who . "</b>,<br>
<br>
How is everything going with your <b>new Photo Gallery from " . $_SESSION['template']['company']['host_photo'] . "!</b>?<br>
<br>
Have you had a chance to <a href='https://" . $_SESSION['template']['company']['host_photo'] . "' target='_" . $_SESSION['template']['company']['host_photo'] . "'>Login to your Gallery</a> from a desktop or laptop? (Although everything technically works on mobile devices, the features are a bit easier to see on a bigger screen!)<ol>
<li>Simply go to the <a href='https://" . $_SESSION['template']['company']['host_photo'] . "' target='_" . $_SESSION['template']['company']['host_photo'] . "'>" . $_SESSION['template']['company']['host_photo'] . "</a> Home Page and click the LOGIN button; (located: upper right hand side of page).</li> 
<br>
<li>Enter your personal email address and password (associated with your " . $_SESSION['template']['company']['host_photo'] . "! account) ... This will take you to the Main Menu of your \"Master\" " . $_SESSION['template']['company']['host_photo'] . " Account!</li>
<br>
<li>From this Main Menu, simply click on your Professional Gallery link (located: under Business Services)!</li>
<br>
Voila!  There you are!<br>
<br>
Be sure to <b>Upload</b> (\"Choose\" or \"Drag & Drop\") <b>your PERSONALIZED LOGO</b> (located: upper left hand side of Gallery)!<br>
<br>
And...<br>
<br>
<b>CUSTOMIZE your Gallery</b> with a Warehouse Theme!<ul>
<li>Click on the <b>\"Edit Gallery Theme\"</b> link (located: top/center of your Gallery page!) and customize:</li><ul>
	<li>Background Color</li>
	<li>\"Warehouse\" Style</li>
	<li>Style Text Color</li>
	<li>Photo Frame Style</li>
	<li>Photo Frame Color</li>
	<li>Text Color</li>
	<li>Style Opacity</li>
	<li>Gallery Frame Color</li>
	<li>Photo Frame Width</li>
	<li>Highlights Color</li>
	</ul>
</ul>
<br>
What are you waiting for?!<br>
<br>
Create the Gallery space you've always wanted -- to store, showcase and sell, all of your best photos!<br>
<br>
Please let us know if we can be of any assistance!  We're here to help you, and are happy to do so!<br>
<br>

Until next time,<br>
<br>
";

$html_insert .= "
" . $_SESSION['template']['company']['name'] . " Support Staff<br>
" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>

";


$final_email_message = "yes";

}


################################################################################
################ photobank_newaccount_followup_2 ###############################
################################################################################

if($email_receipt == "photobank_newaccount_followup_2") {


	
	//$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "Uploading & Managing Photos + Public Preview!";
	
	$text_insert = "";


$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
<b>Dear " . $dear_who . "</b>,<br>
<br>
Have you tried to <b>UPLOAD</b> and <b>MANAGE</b> your <u>photos in your " . $_SESSION['template']['company']['host_photo'] . "</u>!<br>
<br>
If you haven't had a chance to do it yet... it's super easy!  And Fun! :)  <br>
<br>
Go for it!<ul>
<li>Simply LOGIN to your Gallery from <a href='https://" . $_SESSION['template']['company']['host_photo'] . "' target='_" . $_SESSION['template']['company']['host_photo'] . "'>" . $_SESSION['template']['company']['host_photo'] . "</a></li>
<br>
<li>\"<u>Choose Files\" or \"Drag & Drop\" files</u> -- into the \"Photo Uploader\" (located: upper left of your Gallery).</li>
<br>
<li>You can Upload images INDIVIDUALLY or Upload MULTIPLE images (from a <a href='https://www.nebraska.gov/NREC/real/realzipfiles.html' target='ZIP'>ZIPPED Folder</a>).</li>
<br>
<li>Be sure to \"<u>Set or Create\" the Portfolio</u> in which you want your photos to be kept...</li>
<ul><li>You will see options for Private (password protected) or Public Portfolios!</li></ul>
<br>
<li>Also be sure to set your PRICES (\"price tags\" for the 3 file \"types\") and #KEYWORDS!</li>
<br>
<li>Click the CONFIRM & SET Button, to \"save\" the settings!</li>
</ul>
You can EDIT photos INDIVIDUALLY in \"Gallery View\" -- (which is the \"default view\" of your Gallery).<ul>
<li>There is an \"Edit\" Button located beneath every photo.</li>
</ul>
<h3>OR</h3>
You can <u>EDIT MULTIPLE PHOTOS in <b>\"List View</u>\"</b> -- (Option located: upper left of your Gallery -- just above the \"Photo Uploader\") by using the BULK EDITOR (gray \"button\" entitled <b>\"Select Bulk Action\"</b> -- located: upper right of your Gallery).<ul>
<li>In \"List View\", simply \"tick\" the box(es) next to the photos you want to \"manage\" and then choose one of the following \"actions\":</li><ol>
<li>Delete Photo(s)</li>
<li>Update Keywords</li>
<li>Update Pricing</li>
<li>Move to Portfolio</li>
<li>Delete Portfolio</li>
<li>Download Selected Photo(s)</li>
</ol>
</ul>
Lastly, if you ever want to <u>SEE what your Gallery will look like to the PUBLIC</u> (i.e., your friends, colleagues, clients, visitors etc) ... Simply click on the <b>\"PUBLIC Preview\"</b> link (located just to the right of your \"bulk editor\" button).<br>
<br>
We'll leave you with that for now... <br>
<br>
As always, please do not hesitate to get in touch with us should you have any questions, comments, or suggestions!  <br>
<br>
We aim to please and your feedback is much appreciated!<br>
<br>
Until next time,<br>
<br>
The " . $_SESSION['template']['company']['host_photo'] . " Team<br>
<br>
PS. One more tip for you, before we go!<ul>
<li>All \"changes\" that you make to your Gallery (whether uploading or managing) should \"take effect\" immediately.  If by chance they do not... <u>Try hitting the \"RELOAD\" button</u> on your web browser (to re-fresh the page)! ;)</li>
</ul>
<br>
";

$html_insert .= "
" . $_SESSION['template']['company']['name'] . " Support Staff<br>
" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>

";


$final_email_message = "yes";

}


################################################################################
################ photobank_newaccount_followup_3 ###############################
################################################################################

if($email_receipt == "photobank_newaccount_followup_3") {


	
	//$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "Portfolios, Slideshows, and Keywords";
	
	$text_insert = "";


$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
<b>Dear " . $dear_who . "</b>,<br>
<br>
We hope you don't mind us reaching out to you!<br>
<br>
Just a quick note to clarify any questions you may have about <u>Portfolios, Slideshows, and Keywords in your " . $_SESSION['template']['company']['host_photo'] . "</u>.
<br>
When visitors come to see your Online Gallery, the \"default\" Portfolio is set to <b>Gallery Slideshow!</b><ul>

<li>You can change or update the photos displayed in your Gallery Slideshow, by Logging into your Gallery, and \"ticking\" or \"unticking\" the +Slideshow \"check box\" associated with the each photo (located: lower right corner of each Gallery Frame, in your gallery). </li>
<br>
<li>Please note: Slideshows are limited to 25 photos.  <u>Be sure to select your favorite images, to showcase your best work</u>! :)</li>
</ul>
Visitors can also view other Portfolios in your Gallery via the <b>\"Search by Portfolio\"</b> feature; (located: at the very top, and center of your Gallery).  Simply click on the \"pull down menu\", and then select the desired Portfolio.

<ul><li>Note: you may set <u>Portfolios as Private and Password Protected</u> (for private or invite-only, viewing).</li></ul>
Lastly, visitors can use the <b>Refine w/ Keywords</b> feature. (This \"search option\" is also located at the very top, and center, of your Gallery.)  The more specific you are when entering <b>#KEYWORDS</b> (associated with each photo), the more refined the search results will be when a visitor types in their specifications.

<ul><li>#Keywords can be entered by clicking on the EDIT button (located: underneath each photo in your Gallery), OR if multiple photos will contain the same or similar #keywords, it is most efficient to use the <b>\"Select Bulk Action ---> Update Keywords\"</b> Feature! (<b>\"Select Bulk Action\"</b> button is located: upper right of your Gallery.)</li></ul>

We hope you are having fun creating, organizing and managing all of your creative digital assets -- your photos!!!

Please let us know if we can be of further assistance.


Until next time,

The " . $_SESSION['template']['company']['host_photo'] . " Team<br>
<br>
";

$html_insert .= "
" . $_SESSION['template']['company']['name'] . " Support Staff<br>
" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>

";


$final_email_message = "yes";

}


################################################################################
################ photobank_newaccount_followup_4 ###############################
################################################################################

if($email_receipt == "photobank_newaccount_followup_4") {


	
	//$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "Promotion, Distribution and Sales!";
	
	$text_insert = "";


$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;' line-height:25px;>
<b>Dear " . $dear_who . "</b>,<br>
<br>
By now, we hope you are getting very familiar and comfortable with the features of your <b>" . $_SESSION['template']['company']['host_photo'] . "!</b><br>
<br>
There are a just a couple more key features we would love to highlight for your clarity!<br>
<br>
After you have Logged-in to your Gallery, please notice the following:<ul>
<li>Within each \"Gallery Frame\" there is a little \"<u>chain link\" icon</u> (located: upper left of each *image*). </li>
<br>
<li>If you \"Right Click\" on any of these \"chain link\" icons, you are given the opportunity to \"copy\" the <b>GALLERY LINK</b> -- which is associated with that particular image!  </li>
<br>
<li>You can then <b>share this link with friends, clients, etc. if you want to actively promote a specific photo!</b></li>
<br>
<ul><li>NOTE: <i>To \"test\" this link accurately, you must \"copy\" the link, and then LOG OFF of your Gallery before \"clicking\" on the link yourself.  You need to \"act\" as if you are a visitor using this link.-- If you ever click on a Gallery Link and it simply takes you to the Admin View of your Gallery, BE SURE YOU ARE LOGGED OFF of your Gallery ... then try to click the Gallery Link again (to see its proper functionality).</i> ;)</li></ul>
<br>
<li>Within each Gallery Frame there is ALSO has a <b>\"Distribute\" Button</b>; (located: bottom, center of each *image*). -- Have you clicked on that yet? -- You should!  It's a <u><b>powerful promotional and monetizing tool</b></u> that mirrors the functionality of our <a href='http://home." . $_SESSION['template']['company']['host_photo'] . "/#download' target='_photoBAGK'>". $_SESSION['template']['company']['host_photo'] ." Camera App</a>.</li> 
<br>
<li>The <b>\"Distribute\" Button</b> offers a streamlined process that <u>efficiently shares and promotes</u> your images by sending them to your selected Social Networks (with sales and profit in mind)! </li> 
<br>
<ul><li>Facebook and Twitter... (more options available soon!)</li></ul>
<br>
<li>The <b>\"Distribute\" Button</b> also gives you a number of <b>\"Photo Distribution Options\"</b>, including the ability to <u>choose the layout and visual presentation of your customized Branding, Watermarking and Pricing</u>.</li>
<br>
<li>Use the <b>\"Distribute\" Button</b> to <u>SECURELY SHARE, PROMOTE AND MONETIZE your work</u>!</li>

</ul>
<br>
Wishing you great success with your ". $_SESSION['template']['company']['host_photo'] ."!

Please let us know if we can be of further assistance!  We are always here to help as best as we can!


Kindest regards,

The ". $_SESSION['template']['company']['host_photo'] ." Team<br>
<br>
";

$html_insert .= "
" . $_SESSION['template']['company']['name'] . " Support Staff<br>
" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>

";


$final_email_message = "yes";

}









################################################################################
################ REGISTRATION USER (BLINGK): ######################################
################################################################################

if($email_receipt == "registration_user") {

	
	$send_to = $_SESSION['member']['emailaddress'];	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "RECEIPT:  Welcome " . $dear_who . "...!";
	
	$text_insert = "
Dear " . $dear_who . ",

...and a friendly welcome to " . $_SESSION['template']['company']['name'] . ".

https://LOGIN." . $_SESSION['template']['company']['domain'] . "

As you have experienced, " . $_SESSION['template']['company']['name'] . " offers our account holders unprecedented online security!

Our biometrically infused, automated voice authorization process (which you will see during the standard LOGIN process) insures that YOU (and only you) can access and administer your account.

If you need further assistance, please contact our courteous customer support staff.

Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".

We look forward to serving you.

Sincerely,

" . $_SESSION['template']['company']['name'] . " Support Staff
" . $_SESSION['template']['company']['emailaddress_support'] . "
https://" . $_SESSION['template']['company']['host_support'] . "


";


	$html_insert = "<span style='font-size:14px;font-family:helvetica;color:#0000AA;'>
<b>Dear " . $dear_who . ",</b>

...and a friendly welcome to " . $_SESSION['template']['company']['name'] . ".

https://LOGIN." . $_SESSION['template']['company']['domain'] . "

As you have experienced, " . $_SESSION['template']['company']['name'] . " offers account holders <u>unprecedented online security</u>!

Our biometrically infused, automated voice authorization process (which you will see during the standard LOGIN process) insures that YOU (and only you) can access and administer your account.

If you need further assistance, please contact our courteous customer support staff.

Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".

We look forward to serving you.

Sincerely,

" . $_SESSION['template']['company']['name'] . " Support Staff
" . $_SESSION['template']['company']['emailaddress_support'] . "
<a href='https://" . $_SESSION[template][company][host_support] . "' target='" . $_SESSION[template][company][text_name] . "'>https://" . $_SESSION[template][company][host_support] . "</a>
</span>

";


$final_email_message = "yes";


}




############################################################################################################################################
################ MANAGE ACCOUNT SHARING PERMISSIONS (NEW): #################################################################################
############################################################################################################################################

if($email_receipt == "manage_account_sharing_permissions_new") {

	logger_2("send_to: . " . $send_to,"email_receipts");

	//$transaction_timestamp = "";
	
	//$dear_who = "";
	
	//$send_to = "";	
	
	$email_subject = "ATTN: " . $dear_who . " (RE: Account Sharing Notice from " . $_SESSION['account']['accountname'] . ")";
	
	$text_insert = $_SESSION['account']['accountname'] . " has sent you an account sharing request.
	
	To manage this item, please visit this internet address:
	
	https://" . $_SESSION['template']['company']['domain'] . "/" . $_SESSION['account']['emailaddress'] . "+" . $email_permissions_hash;
	
	$html_insert = $_SESSION['account']['accountname'] . " has sent you an account sharing request.
	
	To manage this item, please visit this internet address:
	
	<a href='https://" . $_SESSION['template']['company']['domain'] . "/" . $_SESSION['account']['emailaddress'] . "+" . $email_permissions_hash . "'>https://" . $_SESSION['template']['company']['domain'] . "/" . $_SESSION['account']['emailaddress'] . "+" . $email_permissions_hash . "</a>";

}



############################################################################################################################################
################ MANAGE ACCOUNT SHARING PERMISSIONS (EDITING): #############################################################################
############################################################################################################################################

if($email_receipt == "manage_account_sharing_permissions_editing") {

	logger_2("send_to: . " . $send_to,"email_receipts");

	//$transaction_timestamp = "";
	
	//$dear_who = "";
	
	//$send_to = "";	
	
	$email_subject = "ATTN: " . $dear_who . " (RE: Account Sharing Notice from " . $_SESSION['account']['accountname'] . ")";
	
	$text_insert = "Your account sharing permisions for " . $_SESSION['account']['accountname'] . " has updated.
	
	To view the changes, please visit this internet address:
	
	https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=". $send_to;
	
	$html_insert = "Your account sharing permisions for " . $_SESSION['account']['accountname'] . " has updated.
	
	To view the changes, please visit this internet address:
	
	<a href='https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=". $send_to . "'>https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=" . $send_to . "</a>";

}



############################################################################################################################################
################ voice_signature_sent: #######################################################################################
############################################################################################################################################

if($email_receipt == "voice_signature_sent") {

	logger_2("send_to: . " . $send_to,"email_receipts");

	//$transaction_timestamp = "";
	
	//$dear_who = "";
	
	//$send_to = "";	
	
	$email_subject = "ATTN: " . $dear_who . " (RE: Voice Signature from " . pretty_member_name($_SESSION['member']['memberid']) . ")";
	
	$text_insert = pretty_member_name($_SESSION['member']['memberid']) . " has accepted your Account Sharing invitation, and has replied with a Voice Signtuare for your athentication.
	
	To review the Voice Signature, please Login (normally) to your Personal " . $_SESSION['template']['company']['name'] . " Account with your email address:
	
	https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=". $send_to;
	
	$html_insert = pretty_member_name($_SESSION['member']['memberid']) . " has accepted your Account Sharing invitation, and has replied with a Voice Signtuare for your athentication.
	
	To review the Voice Signtuare, please Login (normally) to your Personal " . $_SESSION['template']['company']['name'] . " Account with your email address:
	
	<a href='https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=". $send_to . "'>https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=" . $send_to . "</a>";

}



############################################################################################################################################
################ voice_signature_activated: #######################################################################################
############################################################################################################################################

if($email_receipt == "voice_signature_activated") {

	logger_2("send_to: . " . $send_to,"email_receipts");

	//$transaction_timestamp = "";
	
	//$dear_who = "";
	
	//$send_to = "";	
	
	$email_subject = "ATTN: " . $dear_who . " (RE: " . $_SESSION['session']['manage_pending_account_sharing']['account']['accountname'] . " Account Sharing - ACTIVATED!)";
	
	$text_insert = "Account Sharing for " . $_SESSION['session']['manage_pending_account_sharing']['account']['accountname'] . " has been activated.
	
	To access your new shared account, please Login (normally) to your Personal " . $_SESSION['template']['company']['name'] . " Account with your email address:
	
	https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=". $send_to;
	
	$html_insert = "Account Sharing for " . $_SESSION['session']['manage_pending_account_sharing']['account']['accountname'] . " has been activated.
	
	To access your new shared account, please Login (normally) to your Personal " . $_SESSION['template']['company']['name'] . " Account with your email address:
	
	<a href='https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=". $send_to . "'>https://" . $_SESSION['template']['company']['domain'] . "/login.b!?member_emailaddress=" . $send_to . "</a>";

}








################################################################################
################ REVERSEAL/REFUND (TO CUSTOMER): ###################
################################################################################

if(
($email_receipt == "reversal_customer") ||
($email_receipt == "reversal_customer_REFUND")
) {

	
	$send_to = $customer_account['emailaddress'];
	$dear_who = $customer_account['accountname'];
	// $from_postfix = " \(NOTICE\)"; <- works, just not used
	$tmp_member_details = member($customer_account['creator_memberid']);
	$email_login_id = $tmp_member_details['hash']; // enables direct to LOGIN
	
	$email_from_name = "receipt.".$_SESSION['template']['company']['name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];
	

	$email_subject = "PAYMENT REFUND (" . $transaction_deposit['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']." | " . $business_account['accountname'] . ")";
	
	$text_insert = "(text)";

//$tmp_phone = authorization_number();

$html_insert = "
<br>
ACCOUNT:  <span style='font-weight:normal;'><u>" . $customer_account['accountname'] . "</u></span>
<br>
ACTIVITY:  <span style='font-weight:normal; color:#990000;'>PAYMENT REFUND</span>
<br>
AMOUNT:  <span style='font-weight:normal; color:#000000;'>" . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']."</span>
<br>
BUSINESS NAME:  <span style='font-weight:normal;'>" . $business_account['accountname'] . "</span>
<br>
BUSINESS EMAIL ADDRESS:  <span style='font-weight:normal;'>" . $business_account['email_account_address'] . "</span>
<br>
<br>
NOTE:  The REFUND has been completed. You should see a credit to your card <u>within 48 hours</u>.  <span style='font-weight:normal;'>(If you would like to complete a payment to this business, please contact the business and initiate a NEW payment.)</span><br>
";

}



################################################################################
################ REVERSAL/REFUND (TO BUSINESS): ##################################
################################################################################

if(
($email_receipt == "reversal_business_REFUND")
) {
	
	$send_to = $business_account['emailaddress'];
	$dear_who = $business_account['accountname'];
	//$transaction_timestamp = "";
	
	$email_from_name = "alert.".$_SESSION['template']['company']['text_name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];
	
	$email_subject = "REVERSAL/REFUNDED: " . $customer_account['accountname'] . ": " . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1'];
	
	$text_insert = "text";

//$tmp_phone = authorization_number($customer_member['memberid']);

if(stristr($set_reason_code,"ADMIN")) {
	$authorized_by = $_SESSION['template']['company']['domain']." Administration";
} else {
	$authorized_by = $_SESSION['member']['firstname'] . " " .$_SESSION['member']['lastname'];
}

if(stristr($set_reason_code,"ADMIN")) {
	$administrative_nessage = $set_administrative_message;
} else {
	$administrative_nessage = "(none)";
}

	$html_insert = "
<br>
ACCOUNT:  <span style='font-weight:normal;'><u>" . $business_account['accountname'] . "</u></span>
<br>
CUSTOMER NAME:  <span style='font-weight:normal;'>" . $customer_account['accountname'] . "</span>
<br>
ACTIVITY:  <span style='font-weight:normal; color:#990000'>REFUND ISSUED</span>
<br>
DETAILS:  <span style='font-weight:normal; color:#990000'>".$update_incoming_return_reason."</span>
<br>
AMOUNT:  <span style='font-weight:normal; color:#000000'>" . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']." <span style='font-size:12px;'>(i.e., <u>" . $transaction_incoming['net_value'] . " ".$_SESSION['template']['company']['currency1']."</u> deducted from your account)</span></span>
<br>
AUTHORIZED BY:  <span style='font-weight:normal;'>".$authorized_by."</span>
<br>
ADMINISTRATIVE MESSAGE:  <span style='font-weight:normal; color:#990000'>".$administrative_nessage."</span>
<br>
";


if($_SESSION['poll']['details']['rating_details']) {
	$html_insert .= "
<br>
CUSTOMER COMMENTS:  <span style='font-weight:normal; color:#990000'>" . $_SESSION['poll']['details']['rating_details'] . "</span>";
}

/*
		$html_insert .= "

CUSTOMER TELEPHONE #: <span style='font-weight:normal;'>+" . $tmp_phone['calling_code'] . " " . $tmp_phone['number'] . "</span>

CUSTOMER EMAIL ADDRESS:  <span style='font-weight:normal;'>" . $customer_account['emailaddress'] . "</span>";
*/

	$html_insert .= "<br>
<br>
<br>
NOTE:  The REVERSAL/REFUND has been completed. (" . $transaction_incoming['transaction_gross_value'] . ") has already been deducted from your applicable balance(s). <b><u>The ONLY way to recover this payment<u> is to CONTACT YOUR CUSTOMER,</b> and have them authorize a NEW PAYMENT.<br>
";

}








################################################################################
################ REVERSEAL/CANCEL (TO CUSTOMER): ###################
################################################################################

if(
($email_receipt == "reversal_customer_CANCEL")
) {

	
	$send_to = $customer_account['emailaddress'];
	$dear_who = $customer_account['accountname'];
	// $from_postfix = " \(NOTICE\)"; <- works, just not used
	$tmp_member_details = member($customer_account['creator_memberid']);
	$email_login_id = $tmp_member_details['hash']; // enables direct to LOGIN
	
	$email_from_name = "receipt.".$_SESSION['template']['company']['text_name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];
	

	$email_subject = "PAYMENT REVERSAL (" . $transaction_deposit['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']." | " . $business_account['accountname'] . ")";
	
	$text_insert = "(text)";

//$tmp_phone = authorization_number();

$html_insert = "
<br>
ACCOUNT:  <span style='font-weight:normal;'><u>" . $customer_account['accountname'] . "</u></span>
<br>
ACTIVITY:  <span style='font-weight:normal; color:#990000;'>CUSTOMER REVERSAL / ORDER CANCELATION</span>
<br>
AMOUNT:  <span style='font-weight:normal; color:#000000;'>" . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']."</span>
<br>
BUSINESS NAME:  <span style='font-weight:normal;'>" . $business_account['accountname'] . "</span>
<br>
BUSINESS EMAIL ADDRESS:  <span style='font-weight:normal;'>" . $business_account['email_account_address'] . "</span>
<br>
<br>
NOTE:  The REFUND has been completed, and your order has been canceled. You should see a credit to your card <u>within 48 hours</u>.  <span style='font-weight:normal;'>(If you would like to complete a payment to this business, please contact the business and initiate a NEW payment.)</span><br>
";

}



################################################################################
################ REVERSAL/CANCEL (TO BUSINESS): ##################################
################################################################################

if(
($email_receipt == "reversal_business_CANCEL")
) {
	
	$send_to = $business_account['emailaddress'];
	$dear_who = $business_account['accountname'];
	//$transaction_timestamp = "";
	
	$email_from_name = "alert.".$_SESSION['template']['company']['text_name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];
	
	$email_subject = "REVERSAL/CANCELATION: " . $customer_account['accountname'] . ": " . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1'];
	
	$text_insert = "text";

$tmp_phone = authorization_number($customer_member['memberid']);

	$html_insert = "
<br>
ACCOUNT:  <span style='font-weight:normal;'><u>" . $business_account['accountname'] . "</u></span>
<br>
ACTIVITY:  <span style='font-weight:normal; color:#990000'>Customer was \"NOT 100% SATISFIED\", and demanded ORDER CANCELATION / REFUND via ".$_SESSION['template']['company']['name']."</span>
<br>
AMOUNT:  <span style='font-weight:normal; color:#000000'>" . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']." <span style='font-size:12px;'>(i.e., <u>" . $transaction_incoming['net_value'] . " ".$_SESSION['template']['company']['currency1']."</u> deducted from your account)</span></span>
<br>
CUSTOMER NAME:  <span style='font-weight:normal;'>" . $customer_account['accountname'] . "</span>";


if($_SESSION['poll']['details']['rating_details']) {
	$html_insert .= "
<br>
CUSTOMER COMMENTS:  <span style='font-weight:normal; color:#990000'>" . $_SESSION['poll']['details']['rating_details'] . "</span>";
}

/*
		$html_insert .= "

CUSTOMER TELEPHONE #: <span style='font-weight:normal;'>+" . $tmp_phone['calling_code'] . " " . $tmp_phone['number'] . "</span>

CUSTOMER EMAIL ADDRESS:  <span style='font-weight:normal;'>" . $customer_account['emailaddress'] . "</span>";
*/

	$html_insert .= "<br>
<br>
<br>
NOTE:  The REVERSAL/REFUND has been completed. (" . $transaction_incoming['transaction_gross_value'] . ") has already been deducted from your applicable balance(s). <b><u>The ONLY way to recover this payment<u> is to CONTACT YOUR CUSTOMER,</b> and have them authorize a NEW PAYMENT.<br>
";

}






################################################################################
################ REVERSAL/FRAUD (TO CUSTOMER): ###################
################################################################################

if(
($email_receipt == "reversal_customer_FRAUD")
) {

	
	$send_to = $customer_account['emailaddress'];
	$dear_who = $customer_account['accountname'];
	//$from_postfix = " \(NOTICE\)";
	
	$email_from_name = "alert.".$_SESSION['template']['company']['text_name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];
	
	$email_subject = "FRAUD/REVERSED: " . $transaction_deposit['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']." from " . $business_account['accountname'];
	
	$text_insert = "(text)";

//$tmp_phone = authorization_number();

$html_insert = "
<br>
ACCOUNT:  <span style='font-weight:normal;'><u>" . $customer_account['accountname'] . "</u></span>
<br>
ACTIVITY:  <span style='font-weight:normal; color:#990000;'>CANCELATION / REVERSAL</span>
<br>
AMOUNT:  <span style='font-weight:normal; color:#000000;'>" . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']."</span>
<br>
BUSINESS NAME:  <span style='font-weight:normal;'>" . $business_account['accountname'] . "</span>
<br>
BUSINESS TELEPHONE #: <span style='font-weight:normal;'>" . $business_account['dayphone'] . "</span>
<br>
BUSINESS EMAIL ADDRESS:  <span style='font-weight:normal;'>" . $business_account['emailaddress'] . "</span>
<br>
<br>
NOTE:  The reversal has been completed, and <b><u>YOUR REPORT OF \"FRAUD\" HAS BEEN RECORDED</u>!</b><br>
";

}



################################################################################
################ REVERSAL/FRAUD (TO BUSINESS): ##################################
################################################################################

if(
($email_receipt == "reversal_business_FRAUD")
) {
	
	$send_to = $business_account['emailaddress'];
	$dear_who = $business_account['accountname'];
	//$transaction_timestamp = "";
	
	$email_from_name = "alert.".$_SESSION['template']['company']['text_name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];
	
	$email_subject = "REVERSAL/FRAUD: " . $customer_account['accountname'] . ": " . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1'];
	
	$text_insert = "text";

$tmp_phone = authorization_number($customer_member['memberid']);

	$html_insert = "
<br>
ACCOUNT:  <span style='font-weight:normal;'><u>" . $business_account['accountname'] . "</u></span>
<br>
ACTIVITY:  <span style='font-weight:normal; color:#990000'>Customer claims \"BUSINESS IS A FRAUD\", and demanded a REFUND via ".$_SESSION['template']['company']['name']."</span>
<br>
AMOUNT:  <span style='font-weight:normal; color:#000000'>" . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']." <span style='font-size:12px;'>(i.e., <u>" . $transaction_incoming['net_value'] . " ".$_SESSION['template']['company']['currency1']."</u> deducted from your account)</span></span>
<br>
CUSTOMER NAME:  <span style='font-weight:normal;'>" . $customer_account['accountname'] . "</span>";


if($_SESSION['poll']['details']['rating_details']) {
	$html_insert .= "
<br>
CUSTOMER COMMENTS:  <span style='font-weight:normal; color:#990000'>" . $_SESSION['poll']['details']['rating_details'] . "</span>";
}

/*
		$html_insert .= "

CUSTOMER TELEPHONE #: <span style='font-weight:normal;'>+" . $tmp_phone['calling_code'] . " " . $tmp_phone['number'] . "</span>

CUSTOMER EMAIL ADDRESS:  <span style='font-weight:normal;'>" . $customer_account['emailaddress'] . "</span>";
*/

	$html_insert .= "<br>
<br>
<br>
NOTE:  The REVERSAL/FRAUD has been completed. (" . $transaction_incoming['transaction_gross_value'] . ") has already been deducted from your applicable balance(s). <b><u>The ONLY way to recover this payment<u> is to CONTACT YOUR CUSTOMER,</b> and have them authorize a NEW PAYMENT.";

}





################################################################################
################ REVERSAL/CHARGBEACK (TO BUSINESS): ############################
################################################################################

if(
($email_receipt == "chargeback_business")
) {
	
	$send_to = $business_account['emailaddress'];
	$dear_who = $business_account['accountname'];
	//$transaction_timestamp = "";
	
	//$from_postfix = " \(ALERT\)";

	$email_from_name = "alert.".$_SESSION['template']['company']['text_name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];
	
	$email_subject = "CHARGEBACK (" . $customer_account['accountname'] . ": " . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1'].")";
	
	$text_insert = "text";

$tmp_phone = authorization_number($customer_member['memberid']);

	$html_insert = "<br>
<br>
ACCOUNT:  <span style='font-weight:normal;'><u>" . $business_account['accountname'] . "</u></span>
<br>
ACTIVITY:  <span style='font-weight:normal; color:#990000'>CHARGEBACK</span><br>";

	$html_insert .= "
<br>
AMOUNT:  <span style='font-weight:normal; color:#000000'>" . $transaction_incoming['transaction_gross_value'] . " ".$_SESSION['template']['company']['currency1']." <span style='font-size:12px;'>(i.e., <u>" . $transaction_incoming['net_value'] . " ".$_SESSION['template']['company']['currency1']."</u> deducted from your account)</span></span>
<br>
CUSTOMER NAME:  <span style='font-weight:normal;'>" . $customer_account['accountname'] . "</span><br>";


if($_SESSION['poll']['details']['rating_details']) {
	$html_insert .= "
<br>
CUSTOMER COMMENTS:  <span style='font-weight:normal; color:#990000'>" . $_SESSION['poll']['details']['rating_details'] . "</span>";
}

/*
		$html_insert .= "

CUSTOMER TELEPHONE #: <span style='font-weight:normal;'>+" . $tmp_phone['calling_code'] . " " . $tmp_phone['number'] . "</span>

CUSTOMER EMAIL ADDRESS:  <span style='font-weight:normal;'>" . $customer_account['emailaddress'] . "</span>";
*/

	$html_insert .= "<br>
<br>
<br>
NOTE:  The chargeback has been completed. (" . $transaction_incoming['transaction_gross_value'] . " has already been deducted from your applicable balance(s).)  <u>ALL CHARGEBACKS ARE FINAL, AND CANNOT BE REVERSED</u>.  (You may ask the customer to RE-authorize a NEW transaction to complete the payment; HOWEVER, you obviously run the RISK that your customer will chargeback AGAIN -- a DOUBLE NEGATIVE impact on your Merchant Rating. <u>Please be careful</u> if you choose this option.)";

}



### NEEDED:
//reversal_customer_REFUND
//reversal_business_REFUND
//chargeback_customer
//chargeback_business
//reversal_customer_FRAUD
//reversal_business_FRAUD






################################################################################
################ DECLINED ALERT (TO BUSINESS): ###################
################################################################################

if($email_receipt == "bank_transaction_declined") {


	$send_to = $_SESSION['payme']['business']['account']['emailaddress'];
	logger3("send_to",$send_to);
	
	$dear_who = $_SESSION['payme']['business']['account']['accountname'];
	logger3("dear_who",$dear_who);
	
	$from_postfix = " \(TRANSACTION\)";
	
	//$dear_who = "";
	//$transaction_timestamp = "";
	
	$email_subject = "DECLINED: " . $_SESSION['payme']['customer']['bank_account']['holder'] . " (" . $_SESSION['payme']['amount_currency_0'] . " " . $_SESSION['payme']['currency_code_0'] . " / Unable to authorize account.)";
	
	$text_insert = "(text)";

//$tmp_phone = authorization_number();

	$html_insert = "

ACCOUNT:  <span style='font-weight:normal;'><u>" . $_SESSION['payme']['business']['account']['accountname'] . "</u></span>

ACTIVITY: <span style='font-weight:normal;'>PAYMENT</span>

CUSTOMER NAME:  <span style='font-weight:normal;'>" . $_SESSION['payme']['customer']['bank_account']['holder'] . "</span>

AMOUNT:  <span style='font-weight:normal; color:#000000;'>" . $_SESSION['payme']['amount_currency_0'] . " " . $_SESSION['payme']['currency_code_0'] . "</span>

RESULT:  <span style='font-weight:normal; color:#990000;'>DECLINED: Unable to authorize account.</span>

TIMESTAMP: " .  datetime() . " (GMT)
";

}



################################################################################
################ PAYBYSEPA SELLER (TRANSACTION COMPLETED): #####################
################################################################################


if($email_receipt == "paybysepa_incoming_completed") {

	//logger3("email:",$);
	logger3("email:email_receipt",$email_receipt);
	$tmp_seller_account = account($tmp_transactions['incoming']['accountid']);
	$tmp_buyer_account = account($tmp_transactions['deposit']['accountid']);
	
	
	$from_postfix = " \(TRANSACTION\)";
	logger3("email: from_postfix",$from_postfix);
	
	$send_to = $tmp_seller_account['emailaddress'];
	logger3("email: send_to",$send_to);
	
	$dear_who = $tmp_buyer_account['accountname'];
	logger3("email: dear_who",$dear_who);
	
	$email_subject = "COMPLETED: ".$_SESSION['template']['company']['currency1']." " . $tmp_transactions['incoming']['transaction_gross_value'] . " (" . $tmp_buyer_account['accountname'] . ")";
	logger3("email: email_subject",$email_subject);
	
	//$text_insert
	//$html_insert
	
	//$email_subject = "RECEIPT: " . $transaction_value . " PAYMENT (TO \"" . $recipient_accountname . "\") Has Been Approved";
	
	$text_insert = "";


	$html_insert = "

AFFECTED ACCOUNT:  <span style='font-weight:normal;'><u>" . $tmp_buyer_account['accountname'] . "</u></span>

ACTIVITY: <span style='font-weight:normal;'>PAYMENT STATUS UPDATE</span>

CUSTOMER NAME:  <span style='font-weight:normal;'>" . $tmp_buyer_account['accountname'] . "</span>

PAYMENT AMOUNT:  <span style='font-weight:normal; color:#000000;'>" . $tmp_transactions['incoming']['currency_0_iso3'] . " " . $tmp_transactions['incoming']['currency_0_total'] . "</span>

UPDATED STATUS:  <span style='font-weight:normal; color:#007700;'>COMPLETED</span> <span style='font-weight:normal; color:#444444;'>(This transaction is <b><u>no longer subject to chargebacks</u>.)</span>

TIMESTAMP: " . timezone($tmp_seller_account['creator_memberid'],$tmp_transactions['incoming']['updated_datetime'],"goodlooking") . "";

}




################################################################################
################ 100% SATISFACTION GUARANTEED: ###################
################################################################################

if($email_receipt == "customer_satisfaction_guaranteed") {

	/* API:
	
	$email_receipt = ;
	
	$email_subject = ;
	$email_from_name = ;
	$email_reply_to_address = ;
	$email_business_emailaddress = ;
	
	$send_to = ;	
	$dear_who = ;
	
	*/

	
	$text_insert = "";

	$html_insert = "<br>";
	$html_insert .= "<span style='font-size:16px; font-weight:normal; line-height:45px;'>";
	$html_insert .= "Just a quick email to remind you that <B><u>".$_SESSION['template']['company']['name']." GUARANTEES 100% Customer Satisfaction</u>!</B>";
	$html_insert .= "<br>";
	$html_insert .= "<B><u>If you are ever UNSATISFIED</u></B> with your purchase from:";
	$html_insert .= "<br>";
	$html_insert .= "&nbsp;&nbsp; &bull; ";
	$html_insert .= $email_business_name;
	if(!empty($email_reply_to_address)) {
		$html_insert .= " (".$email_reply_to_address.")";
	}
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	$html_insert .= "...PLEASE USE one of the following links:</span>".return_refund_footer($transaction_hash);

}




################################################################################
################ CUSTOMER SATISFACTION FOLLOWUP: ###################
################################################################################

if($email_receipt == "customer_satisfaction_guaranteed_followup") {

	/* API:
	
	$email_receipt = ;
	
	$email_subject = ;
	$email_from_name = ;
	$email_reply_to_address = ;
	$email_business_emailaddress = ;
	
	$send_to = ;	
	$dear_who = ;
	
	*/

	
	$text_insert = "";

	$html_insert = "<br>";
	$html_insert .= "<span style='font-size:16px; font-weight:normal; line-height:45px;'>";
	$html_insert .= "Just a quick email to remind you that <B><u>".$_SESSION['template']['company']['name']." GUARANTEES 100% Customer Satisfaction</u>!</B>";
	$html_insert .= "<br>";
	$html_insert .= "<B><u>If you are ever NOT SATISFIED</u></B> with your PC / TECH SERVICES purchase:";
	$html_insert .= "<br>";
	$html_insert .= "PURCHASE DATE: ". $email_date_of_purchase;
	$html_insert .= "<br>";
	$html_insert .= "PURCHASE FROM: ". $email_business_name;
	if(!empty($email_reply_to_address)) {
		$html_insert .= " (".$email_reply_to_address.")";
	}
	$html_insert .= "<br>";
	$html_insert .= "PURCHASE AMOUNT: USD ". $email_purchase_amount;
	$html_insert .= "<br>";
	$html_insert .= "<br>";
	$html_insert .= "...PLEASE USE one of the following links to cancel your order & request a refund:</span>".return_refund_footer($transaction_hash);

}




################################################################################
################ REMEMBER TO USE THE CRM #######################################
################################################################################

if(
($email_receipt == "remember_to_use_CRM")
) {

	
	$send_to = $business_account['email_account_address'];
	$dear_who = $business_account['accountname'] . " " . $business_account['business_type'];
	//$from_postfix = " \(NOTICE\)";
	
	$email_from_name = "reminder.".$_SESSION['template']['company']['name'];
	$email_reply_to_address = $_SESSION['template']['company']['emailaddress_support'];
	
	// "random" subject
	if(Rand(1,2) == 1) {
		$email_subject = "How to Prevent Chargebacks?";
	} else {
		$email_subject = "Use the $master_config_CRM_callback_days Day CRM to PREVENT chargebacks!";
	}
	
	
	$text_insert = "(text)";

//$tmp_phone = authorization_number();

$html_insert = "
<b>Remember to use the $master_config_CRM_callback_days Day CRM</b> -- offered for FREE, <u>by ". $_SESSION['template']['company']['name'] ."</u> -- to PREVENT chargebacks!<br>
<br>
<u>To use the $master_config_CRM_callback_days Day CRM</u>:<br>
<br>
<b>STEP 1.</b>  <a href='https://LOGIN.". $_SESSION['template']['company']['domain'] ."?member_emailaddress=". $business_creator_member['emailaddress'] ."'>https://LOGIN.". $_SESSION['template']['company']['domain'] ."</a><br>
<br>
<b>STEP 2.</b> Select your Business Account (". $business_account['accountname'] . " " . $business_account['business_type'] .") from the Main Menu.<br>
<br>
<b>STEP 3.</b> Select the <u>$master_config_CRM_callback_days Day CRM</u> from the Account Menu.<br>
<br>
<b>For best results,</b> please use this FREE callback service to follow-up with your customers on the suggested $master_config_CRM_callback_days day callback schedule.<br>
<br>
<b>IMPORTANT NOTE:</b> Be sure to use the REFUND button - <i>LIBERALLY</i> - to prevent chargebacks and improve your Merchant Rating (<u>lowers your merchant fees and improves your payout schedule</u>)!<br>
<br>
";

}







################################################################################
################ REVERSAL/FRAUD (TO CUSTOMER): ###################
################################################################################

if(
($email_receipt == "invite_sepa_network")
) {

	
	# $send_to = $customer_account['emailaddress'];
	# $dear_who = $customer_account['accountname'];
	# //$from_postfix = " \(NOTICE\)";
	# 
	# $email_from_name = "PAYBYSEPA.com";
	# $email_reply_to_address = "support@bangk.com";
	# 
	# $email_subject = "Your Credit Card Processing Account is APPROVED!";
	
	$text_insert = "	
We are happy to inform you that your Global credit card Merchant Processing Account has been approved.

To activate your account, please follow this link to BANGK.com:

https://start.BANGK.com?invite=$link_invite

NOTE: PAYBYSEPA.com is temporarily offline until JAN 15, 2014.  Until then, we are happy and excited to provide you with AMEX, MasterCard and VISA credit card processing services via BANGK.com.

";

//$tmp_phone = authorization_number();

	$html_insert = "
<span style='font-size:16px; color:#444444; font-weight:normal;'>
<br>
We are happy to inform you that <u>your Global Credit Card Merchant Processing Account has been APPROVED</u>.<br>
<br>
To activate your account, please follow this link to BANGK.com:<br>
<br>
<a href='https://start.BANGK.com?invite=$link_invite'><b>https://start.BANGK.com?invite=$link_invite</b></a><br>
<br>
<br>
NOTE: PAYBYSEPA.com is temporarily offline until JAN 15, 2014.  Until then, <b>we are happy and excited to provide you with <u>AMEX, MasterCard and VISA</u> credit card processing services via BANGK.com.</b><br>
<br>
(Please disregard this email <u>if you are already processing credit cards with BANGK</u>!)<br>
</span>
<br>
";

}



################################################################################
################ REVERSAL/FRAUD (TO CUSTOMER): ###################
################################################################################

if(
($email_receipt == "venture_update_201311")
) {

	
	$final_email_message = "yes";
	
	$text_insert = "Greetings, $dear_who
	
We are happy to inform you that your Global credit card Merchant Processing Account has been approved.

To activate your account, please follow this link to BANGK.com:

https://register.BANGK.com?invite=$send_to

NOTE: PAYBYSEPA.com is temporarily offline until JAN 15, 2014.  Until then, we are happy and excited to provide you with AMEX, MasterCard and VISA credit card processing services via BANGK.com.

";

//$tmp_phone = authorization_number();

	$html_insert = "<br>
<span style='color:#444444; font-size:16px; font-weight:normal; line-height: 25px;'> 
<b>Greetings, Investors and Advisors!</b><br>
Though I have been in personal communication with many of you (please know, I am always available upon request to each of you), I do apologize for the lack of formal updates much of this year -- a year of ups and downs


Shea Writer
Director; NSDB Group
Australia: +61 2 8011 4406
UK: +44 20 8144 7796
USA: +1 917 310 0864
https://NSDB.com

LEGAL NOTICE: The entirety of communication is to be recognized as CONFIDENTIAL:
Intended to be reviewed by the designated addressee, exclusively.

</span>";

}




################################################################################
################ REVERSAL/FRAUD (TO CUSTOMER): ###################
################################################################################

if(
($email_receipt == "vocaSIGN_customer_authorization_receipt")
) {

	

	
	
	$final_email_message = "yes";
	
	$text_insert = "";
	
	$tmp_customer_name = ucwords(strtolower($_SESSION['incoming_api_session']['CUSTOMER_NAME']));
	
	
	if(stristr($_SESSION['incoming_api_session']['AUTHORIZATION_CATEGORY'],"PAYMENT")) {
		
		$tmp_return_days = $_SESSION['incoming_api_session']['AUTHORIZATION_RETURN_POLICY'];
		
		if(
		($tmp_return_days == "0") ||
		($tmp_return_days == 0) ||
		($tmp_return_days == "") ||
		($tmp_return_days == "zero")
		) {
			$insert_terms_of_service_remider = "<nobr>ALSO, please remember to <u>contact the merchant directly with any comments / questions regarding dissatisfaction or billing:";
		} else {
			
			if($tmp_return_days == 1) {
				$day_s = "day";
			} else {
				$day_s = "days";
			}
			
			$insert_terms_of_service_remider = "<nobr>ALSO, please remember to <u>contact the merchant directly within ". $tmp_return_days ." $day_s</u></nobr> with any comments / questions regarding dissatisfaction or billing:";
		}
		
	
	} else if(stristr($_SESSION['incoming_api_session']['AUTHORIZATION_CATEGORY'],"RECURRING")) {
	
		$tmp_return_days = $_SESSION['incoming_api_session']['AUTHORIZATION_FREE_TRIAL'];
		$tmp_subscription_schedule = $_SESSION['incoming_api_session']['AUTHORIZATION_RECURRING_SCHEDULE'];
		
		if(
		($tmp_return_days == "0") ||
		($tmp_return_days == 0) ||
		($tmp_return_days == "") ||
		($tmp_return_days == "zero")
		) {
			$insert_terms_of_service_remider = "<nobr>ALSO, please remember to <u>contact the merchant directly with any comments / questions regarding dissatisfaction or subscription billing:";
		} else {

			if($tmp_return_days == 1) {
				$day_s = "day";
			} else {
				$day_s = "days";
			}
			
						
			$insert_terms_of_service_remider = "<nobr>ALSO, please remember that your free trial ends in $tmp_return_days $day_s, and to <u>contact the merchant directly within ". $tmp_return_days ." $day_s</u></nobr> if you wish to cancel the $tmp_subscription_schedule subscription:";
		}
	}
	
	
	
	
	$tmp_sql = "SELECT * FROM accounts WHERE hash = '". $_SESSION['incoming_api_session']['BUSINESS_ACCOUNT_ID'] ."';";
	logger3("EMAIL_RECEIPTS.SHARED :: vocaSIGN_customer_authorization_receipt :: tmp_sql",$tmp_sql);
	
	$tmp_merchant_details = readTHECASHIER($tmp_sql);
	logger3("EMAIL_RECEIPTS.SHARED :: vocaSIGN_customer_authorization_receipt :: tmp_merchant_details",$tmp_merchant_details);
	
	
	if(!empty($tmp_merchant_details->payment_page_business_logo)) {
		$vocasign_email_receipt_merchant_path_to_logo = "https://images.vocasign.com/account_logos/" . $tmp_merchant_details->payment_page_business_logo;
	} else {
		$vocasign_email_receipt_merchant_path_to_logo = "https://images.vocasign.com/logo_vocasign.png";
	}
	$vocasign_email_receipt_merchant_path_to_logo_height = "100px";


	$tmp_complete_merchant_name = "";
	$tmp_complete_merchant_name = $tmp_merchant_details->accountname;
	if(!empty($tmp_merchant_details->business_type)) {
		$tmp_complete_merchant_name .= " " . $tmp_merchant_details->business_type;
	}


	$email_subject = "$". $_SESSION['incoming_api_session']['AUTHORIZATION_AMOUNT'] ." Voice Authorization Payment Receipt (to " . $tmp_complete_merchant_name . ")";
	
	$html_insert = "";
	$html_insert .= "<span style='color:#444444; font-size:16px; font-weight:normal; line-height: 40px;'>";
	$html_insert .= "<b>Hello, " . $tmp_customer_name . "</b>";
	$html_insert .= "<br>";
	$html_insert .= "Here is a link to your voice authorization:";
	$html_insert .= "<br>";
	$html_insert .= "<b>CLICK TO LISTEN: <a href=\"". $voice_authorization_audio_url ."\" target='vocaSIGN'>Your Voice Authorization</a></b>";
	$html_insert .= "<br>";
	$html_insert .= $insert_terms_of_service_remider;
	
	$html_insert .= "<hr>";
	$html_insert .= "<b>";
	$html_insert .= "MERCHANT NAME: <u>". $tmp_complete_merchant_name ."</u>";
	$html_insert .= "<br>";
	$html_insert .= "MERCHANT CUSTOMER SUPPORT EMAIL: <a href='mailto:" . $tmp_merchant_details->emailaddress . "'>". $tmp_merchant_details->emailaddress ."</a>";
	$html_insert .= "<br>";
	$html_insert .= "MERCHANT CUSTOMER SUPPORT TELEPHONE: <a href='tel:" . $tmp_merchant_details->customer_support_phone_number_1 . "'>" . $tmp_merchant_details->customer_support_phone_number_1 . "</a>";
	$html_insert .= "</b>";
	$html_insert .= "<hr>";
	
	$html_insert .= "Thank you for your attention.";
	$html_insert .= "</span>";

	///test("html_insert",$html_insert);

}





################################################################################
################ VOCEONE GATEWAY ADD NEW MERCHANT INVITATION: ######################################
################################################################################

if($email_receipt == "vocasign_gateway_new_merchant_registration") {

	
	$email_receipt = "vocasign_gateway_new_merchant_registration";
	$send_to = $set_merchant_emailaddress;
	$dear_who = $set_merchant_name;
	$transaction_timestamp = $set_datetime_created;
	$email_subject = "INVITATION to join the vocaSIGN Program"; 
	
	
	
	$email_merchant_name = $set_merchant_name;
	if(!empty($set_merchant_dba)) {
		$email_merchant_name .= " [" . $set_merchant_dba ."]";
	}

	$html_insert = "<span style='font-size:18px;font-family:helvetica;color:#444444; line-height:35px;'>
	<b>Dear " . $email_merchant_name . ",</b><br>
	<br>
	<b>You have been invited by <u>". $_SESSION['account']['accountname'] ."</u></b> to join the vocaSIGN&trade;, chargeback mitigation program.<br>
	<br>
	Please click on the link (just below) to ACCEPT the invitation, and REGISTER NOW:<br>
	<br>
	<b>
		<a href='https://REGISTER." . $_SESSION['template']['company']['domain'] . "?gateway_merchant_invitation=". $set_hash ."'>https://REGISTER." . $_SESSION['template']['company']['domain'] . "?gateway_merchant_invitation=". $set_hash ."</a>
	</b>
	<br>
	<br>
	Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".
	<br>
	We look forward to serving you.
	<br>
	Regards,<br>
	" . $_SESSION['template']['company']['name'] . " Support Staff<br>
	" . $_SESSION['template']['company']['emailaddress_support'] . "<br>
	<a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_name'] . "'>https://" . $_SESSION['template']['company']['host_support'] . "</a></span><br>
	
	";


	$final_email_message = "yes";


}


############################################################################################################################################
################ TEMPLATE: #################################################################################################################
############################################################################################################################################

if($email_receipt == "template") {

	//$transaction_timestamp = "";
	
	//$dear_who = "";
	
	$send_to = "";	
	
	$email_subject = "";
	
	$text_insert = "";
	
	$html_insert = "";

}



############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################

############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################
############################################################################################################################################



############################################################################################################################################
################ BUILD EMAIL: ##############################################################################################################
############################################################################################################################################



if($final_email_message == "yes") {

	### email message already final - no need to build further
	
	$text_message = $text_insert;
	$html_message = $html_insert;
	
	
} else { // build the rst of the email:

	### BASIC TEXT MESSAGE:
	$text_message = "
Greetings, " . $dear_who . "!

" . $text_insert . "


Please log into your " . $_SESSION['template']['company']['name'] . " Account for additional details.

If you need further assistance, please contact our courteous customer support staff.

Thank you for placing your trust in " . $_SESSION['template']['company']['name'] . ".

Sincerely,

" . $_SESSION['template']['company']['name'] . " Support Staff
" . $_SESSION['template']['company']['emailaddress_support'] . "
https://" . $_SESSION['template']['company']['host_support'] . "

";



	### BASIC HTML MESSAGE:
	if(!empty($email_login_id)) {
		$email_footer_parameters = "?login_id=".$email_login_id;
	} else if(!empty($member_emailaddress)) {
		$email_footer_parameters = "?member_emailaddress=".$member_emailaddress;
	} else {
		$email_footer_parameters = ""; // clear form any old session
	}
	
	
	$html_insert = "<span style='
								font-size:".$_SESSION['template']['company']['email_text_size']."; 
								font-weight:".$_SESSION['template']['company']['email_text_weight']."; 
								line-height:".$_SESSION['template']['company']['email_line_height']."; 
								color:".$_SESSION['template']['company']['email_text_color']."; 
								font-family:".$_SESSION['template']['company']['email_text_face'].";
					'>".$html_insert."</span>";
	
	
	
	$html_message = "<span style='font-size:14px;font-family:helvetica;color:#0000AA; line-height:25px;'>
	<span style='font-size:18px; font-weight:bold;'>
		<u>Greetings, " . $dear_who . "</u>!
	</span><br>
<b>" . $html_insert . "</b><span style='font-size:14px;font-family:helvetica;color:#0000AA;'><br>
<hr>
For additional details, please log into your " . $_SESSION['template']['company']['name'] . " Account: &nbsp; <a href='https://login.".$_SESSION['template']['company']['domain']."$email_footer_parameters'><b>LOGIN.".$_SESSION['template']['company']['domain']."</b></a><br>
If you need further assistance, please contact our courteous customer support staff.<br>
Thank you for placing your <u>trust in " . $_SESSION['template']['company']['name'] . "</u>.<br>
Regards,<br>
<b>" . $_SESSION['template']['company']['name'] . " Support Staff</b><br>
".$_SESSION['template']['company']['emailaddress_support']."<br>
<span class='email_receipt_footer_support'><a href='https://" . $_SESSION['template']['company']['host_support'] . "' target='" . $_SESSION['template']['company']['text_'] . "'>https://SUPPORT." . $_SESSION['template']['company']['domain'] . "</a></span></span><br>";


	### IF BUYER, SHOW GUARANTEE!!
	if($email_receipt == "quickbuy_creditcard_buyer") {

		$html_message .= return_refund_footer($transaction_hash);
	}
}


############################################################################################################################################
################ SEND EMAIL: ###############################################################################################################
############################################################################################################################################


################################################################################
### SEND TO + CC: ##############################################################

### NOTE: basically this prvents CC msgs frm being sent when the receipient is the business. 
### no need to send the msg twice... to whom?! ;)

if($send_to_cc) {

	### SEND TO: ######################################################################
	
	### DEAR:
	$tmp_text_message = str_replace("\$dear_who","$dear_who",$text_message);
	$tmp_html_message = str_replace("\$dear_who","$dear_who",$html_message);
	
	### MESSAGE
	$tmp_text_message = $tmp_text_message . "cc: <font color=aa5555>" . $_SESSION['admin']['details']['account']['emailaddress'] . "</font color>";
	$tmp_html_message = $tmp_html_message . "cc: <font color=aa5555>" . $_SESSION['admin']['details']['account']['emailaddress'] . "</font color>";
	
	### EMAIL
	$tmp_html_message = "<table>" . $tmp_html_message . "</table>";
	$tmp_html_message = emailpage($tmp_html_message,$email_insert_style);
	
	
	### SEND
	//EMMMAIL_7_4($send_to, $_SESSION['template']['company']['emailaddress_support'], $_SESSION['template']['company']['name'] . " " . $email_descriptive, $email_subject, $tmp_text_message, $tmp_html_message);
	//EMMMAIL_N1($send_to, $_SESSION['template']['company']['emailaddress_support'], $_SESSION['template']['company']['name'] . " " . $email_descriptive, $email_subject, $tmp_text_message, $tmp_html_message, "64.132.46.3");



	### ADMIN CC:
	if($send_administrative_cc) {
		sleep(1); # seems to help the email going out
		//$send_administrative_cc is set in shared/functions.shared
		//EMMMAIL_N1("$send_administrative_cc", $_SESSION['template']['company']['emailaddress_support'], "BCC: " . $_SESSION['template']['company']['name'] . " " . $email_descriptive, $email_subject, $tmp_text_message, $tmp_html_message, "64.132.46.3");
	}
	

	### + CC:  #####################################################################
	
	### SET DEAR:
	$tmp_text_message = str_replace("\$dear_who",$_SESSION['admin']['details']['account']['accountname'],$text_message);
	$tmp_html_message = str_replace("\$dear_who",$_SESSION['admin']['details']['account']['accountname'],$html_message);
	
	### SET CC
	$tmp_text_message = $tmp_text_message . "cc: <font color=aa5555>" . $_SESSION['admin']['details']['member']['emailaddress'] . "</font color>";
	$tmp_html_message = $tmp_html_message . "cc: <font color=aa5555>" . $_SESSION['admin']['details']['member']['emailaddress'] . "</font color>";
	
	### BUILD MESSAGE
	$tmp_html_message = "<table width='99%' border='0'>" . $tmp_html_message . "</table>";
	$tmp_html_message = emailpage($tmp_html_message,$email_insert_style);
	
	### SEND
	//EMMMAIL_7_4($_SESSION['admin']['details']['account']['emailaddress'], $_SESSION['template']['company']['emailaddress_support'], $_SESSION['template']['company']['name'] . " " . $email_descriptive, $email_subject, $tmp_text_message, $tmp_html_message);
	//EMMMAIL_N1($_SESSION['admin']['details']['account']['emailaddress'], $_SESSION['template']['company']['emailaddress_support'], $_SESSION['template']['company']['name'] . " " . $email_descriptive, $email_subject, $tmp_text_message, $tmp_html_message, "64.132.46.3");

	### ADMIN CC:
	if($send_administrative_cc) {
		sleep(1); # seems to help the email going out
		# $send_administrative_cc is set in shared/functions.shared
		//EMMMAIL_N1("$send_administrative_cc", $_SESSION['template']['company']['emailaddress_support'], "BCC: " . $_SESSION['template']['company']['name'] . " " . $email_descriptive, $email_subject, $tmp_text_message, $tmp_html_message, "64.132.46.3");
	}


################################################################################
### SEND TO (SINGLE EMAIL): ####################################################

} else {	
	
	logger3("send_to",$send_to);

	### BUILD FINAL TEXT MESSAGE
	$final_text_message = $text_message;
	
	### BUILD FINAL HTML MESSAGE
	$tmp_html_message = "<table width='99%' border='0'>" . $html_message . "</table>";
	$final_html_message = emailpage($tmp_html_message,$email_insert_style);
	
	//test("final_html_message",$final_html_message);
	//exit;
	
	if($email_test == "yes") {
	
		
		### TEST: (https://www.omegabank.com/test/test_email.php)
		EMMMAIL_N1_1("1122ee44@gmail.com", "support@BANGK.com", "BANGK.com", $email_subject, $final_text_message, $final_html_message, "192.168.0.51", "OmegaBank.com");
		echo $final_html_message;
	
	} else {
	
		//$test123 = "on";
		if($test123 == "on") {
			test("send_to",$send_to);
			test("template['company']['emailaddress_support']",$_SESSION['template']['company']['emailaddress_support']);
			test("template['company']['simple_name']",$_SESSION['template']['company']['simple_name']);
			test("email_subject",$email_subject);
			test("final_text_message",$final_text_message);
			test("final_html_message",$final_html_message);
			test("master_config_web_server_ip_generic",$master_config_web_server_ip_generic);
			test("template['company']['domain']",$_SESSION['template']['company']['domain']);
		}
		
	
		### SEND
		//logger3("email_subject",$email_subject);
		//logger3("final_html_message",$final_html_message);
		
		//mail_me($to,$from,$subject,$message,$reply_to)
		
		if($email_descriptive) { 
			$send_from_postfix =  " " . $email_descriptive;
		} else if($from_postfix) {
			$send_from_postfix = $from_postfix;
		}
		
		$send_from_postfix = stripslashes($send_from_postfix);
		$send_from_postfix = addslashes($send_from_postfix);
		
		$send_from_postfix = str_replace("\(", "(", $send_from_postfix);
		$send_from_postfix = str_replace("\)", ")", $send_from_postfix);
		
		$send_from_postfix = str_replace("(", "\(", $send_from_postfix);
		$send_from_postfix = str_replace(")", "\)", $send_from_postfix);
		
		
		logger3("_SESSION['template']['company']['domain']",$_SESSION['template']['company']['domain']);
		logger3("send_from_postfix",$send_from_postfix);
		
		
		
		
		
		if(empty($email_from_name)) $mailme_from_name = $_SESSION['template']['company']['domain'] . $send_from_postfix;
		
		if(empty($reply_to) && isset($email_reply_to_address)) $reply_to = $email_reply_to_address;
		
		if(empty($reply_to)) $reply_to = $_SESSION['template']['company']['emailaddress_support'];
		
		//test("email_receipt: to",$to);
		//test("email_receipt: send_to",$send_to);
		if(empty($to) && isset($send_to)) $to = $send_to;
		
		
		if(empty($from) && isset($mailme_from_name)) $from = $mailme_from_name;
		if(empty($from) && isset($from_name)) $from = $from_name;
		if(empty($from) && isset($email_from_name)) $from = $email_from_name;
		
		if(empty($reply_to) && isset($from_address)) $reply_to = $from_address;
		if(empty($reply_to) && isset($email_from_address)) $reply_to = $email_from_address;
		
		
		if(empty($subject) && isset($email_subject)) $subject = $email_subject;

		if($diplay_visual_test == "YES") { //display final email - do not email
			//test("final_html_message",$final_html_message);
		} else {
		
			mail_me($to,$from,$subject,$message=$final_html_message,$reply_to);
			//test("email_receipt: to",$to);
			//test("email_receipt: from",$from);
			//test("email_receipt: message",$message);
			//test("email_receipt: reply_to",$reply_to);
			
			//exit;
			
			if(!empty($email_receipt_cc)) {
				
				mail_me($to=$email_receipt_cc,$from,$subject,$message=$final_html_message,$reply_to);
				
			}
		}
		
		
		
		## clear vars:
		$to = "";
		$from = "";
		$subject = "";
		$message = "";
		$final_html_message = "";
		$reply_to = "";
		
		$email_from_name = "";
		$mailme_from_name = "";
		$send_from_postfix = "";
		$send_to = "";
		$from_name = "";
		$from_address = "";
		$email_from_address = "";
		$email_reply_to_address = "";
		$email_subject = "";
		
		
		//mailer($email_to_emailaddress=$send_to, $email_from_name=$email_from . $email_from_postfix, $email_subject=$email_subject, $email_html_message=$final_html_message, $email_reply_to_emailaddress);
		
		//mail_me($to,$from,$subject,$message,$reply_to)
		
/*		
		EMMMAIL_N1_1($send_to, $_SESSION['template']['company']['emailaddress_support'], $_SESSION['template']['company']['simple_name'], $email_subject, $final_text_message, $final_html_message, $master_config_web_server_ip_generic, $_SESSION['template']['company']['domain']);
		
		

		logger_2("got to EMMMAIL_CS - TEXT: . " . $text_message,"email_receipts");
		logger_2("got to EMMMAIL_CS - TEXT: . " . $html_message,"email_receipts");
		
		### EMMMAIL N2 (CS):  ######################################################
		$to_address = $send_to;
		$from_address = ""; // defaults to $template
		$from_name = "";  // defaults to $template
		$subject = $email_subject;
		$text_message = $final_text_message;
		$html_message = $final_html_message;
		$bounce_address = "";  // defaults to $template
		$from_id = "";  // defaults to $template
		$domain_name = "";  // defaults to $template
		$ip_address = "";  // defaults to $master_config
		EMMMAIL_CS($to_address, $from_address, $from_name, $subject, $text_message, $html_message, $bounce_address, $from_id, $domain_name, $ip_address);
		#################################################################################################################################################
*/	
		
		
		
		
	}
	
	### ADMIN CC:
	if($cc_accounting) {
		sleep(1);
		mail_me($master_config_accounting_emailaddress,$_SESSION['template']['company']['domain'] . $send_from_postfix,$email_subject,$final_html_message,$_SESSION['template']['company']['emailaddress_support']);
		unset($cc_accounting);
	}

}




############################################################################################################################################
################ END: ######################################################################################################################
############################################################################################################################################


$email_receipt = NULL;
$final_email_message = NULL;
$email_test = NULL;
$send_to = NULL;
unset($email_insert_style);

?>

