1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8function payment_behavior_cart_send_confirm_email($u, $email_template_ids = [])
9{
10	global $prefs;
11	$userlib = TikiLib::lib('user');
12	$smarty = TikiLib::lib('smarty');
13	require_once('lib/webmail/tikimaillib.php');
14	$email = $userlib->get_user_email($u);
15	if (! $email) {
16		return false;
17	}
18	$smarty->assign("email_template_ids", $email_template_ids);
19	$mail_subject = $smarty->fetch('mail/cart_order_received_reg_subject.tpl');
20	$mail_data = $smarty->fetch('mail/cart_order_received_reg.tpl');
21	$mail = new TikiMail();
22	$mail->setSubject($mail_subject);
23	if ($mail_data == strip_tags($mail_data)) {
24		$mail->setText($mail_data);
25	} else {
26		$mail->setHtml($mail_data);
27	}
28	$mail->send($email);
29	return true;
30}
31