function commerce_invoice_receipt_action_mail in Commerce Invoice Receipt 7
Same name and namespace in other branches
- 7.2 commerce_invoice_receipt.rules.inc \commerce_invoice_receipt_action_mail()
2 string references to 'commerce_invoice_receipt_action_mail'
File
- ./
commerce_invoice_receipt.module, line 323 - Provides a printable invoice receipt along with HTML mailing rules.
Code
function commerce_invoice_receipt_action_mail($order, $to, $subject, $from = NULL) {
$to = str_replace(array(
"\r",
"\n",
), '', $to);
$from = !empty($from) ? str_replace(array(
"\r",
"\n",
), '', $from) : NULL;
$recipients = explode(',', $to);
$params = array(
'subject' => $subject,
'order' => $order,
);
$account = user_load($order->uid);
$language = user_preferred_language($account);
foreach ($recipients as $recipient) {
if ($recipient == '') {
continue;
}
$message = drupal_mail('commerce_invoice_receipt', 'invoice', $recipient, $language, $params, $from);
if ($message['result']) {
watchdog('rules', 'Successfully sent email to %recipient', array(
'%recipient' => $recipient,
));
}
}
}