function uc_coupon_purchase_email in Ubercart Discount Coupons 6
Same name and namespace in other branches
- 7.3 uc_coupon_purchase/uc_coupon_purchase.rules.inc \uc_coupon_purchase_email()
- 7.2 uc_coupon_purchase/uc_coupon_purchase.rules.inc \uc_coupon_purchase_email()
Send an email with order and coupon replacement tokens.
2 string references to 'uc_coupon_purchase_email'
- uc_coupon_purchase_ca_action in uc_coupon_purchase/
uc_coupon_purchase.ca.inc - Implementation of hook_ca_action().
- uc_coupon_purchase_ca_predicate in uc_coupon_purchase/
uc_coupon_purchase.ca.inc - Implementation of hook_ca_predicate().
File
- uc_coupon_purchase/
uc_coupon_purchase.ca.inc, line 140
Code
function uc_coupon_purchase_email($order, $coupon, $settings) {
$settings['replacements'] = array(
'global' => NULL,
'order' => $order,
'coupon' => $coupon,
);
$recipients = array();
$addresses = token_replace_multiple($settings['addresses'], $settings['replacements']);
foreach (explode("\n", $addresses) as $address) {
$recipients[] = trim($address);
}
foreach ($recipients as $email) {
$sent = drupal_mail('uc_order', 'action-mail', $email, uc_store_mail_recipient_language($email), $settings, $settings['from']);
if (!$sent['result']) {
watchdog('ca', 'Attempt to e-mail @email concerning order @order_id failed.', array(
'@email' => $email,
'@order_id' => $order->order_id,
), WATCHDOG_ERROR);
}
}
}