function ad_actions_send_email_action_after in Advertisement 6.3
Same name and namespace in other branches
- 6.2 actions/ad_actions.module \ad_actions_send_email_action_after()
- 7 actions/ad_actions.module \ad_actions_send_email_action_after()
Implementation of a configurable Drupal action. Schedules an email, sent before scheduled actions.
File
- actions/
ad_actions.module, line 192 - Enable ad triggers and actions.
Code
function ad_actions_send_email_action_after($object, $context) {
if ($context['after']) {
// send delayed notification email
if (!db_result(db_query_range("SELECT 1 FROM {ad_actions_queue} WHERE aid = %d AND period = %d AND recipient = '%s'", $object->aid, $context['after'], $context['recipient'], 0, 1))) {
db_query("INSERT INTO {ad_actions_queue} (aid, recipient, period, scheduled, context) VALUES(%d, '%s', %d, %d, '%s')", $object->aid, $context['recipient'], $context['after'], time() + $context['after'], serialize($context));
watchdog('action', 'Queued email to %recipient', array(
'%recipient' => $context['recipient'],
));
}
}
else {
// send instant notification email
_ad_actions_send_email($context);
}
}