New travel email

This commit is contained in:
2014-06-17 17:10:16 +10:00
parent 6a05848fee
commit db086fbb5f
5 changed files with 121 additions and 14 deletions

View File

@@ -365,6 +365,49 @@ function _booking_missedpayment_email($nid)
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
/**
* Function to generate email to be sent to the attendee requesting them to complete their travel form
*
* @param $nid - the registration node
*/
function _booking_travelform_request_email($nid)
{
global $event;
global $user;
$language = user_preferred_language($user);
//return without doing anything if we shouldn't send workflow emails
if (variable_get('booking_auto_workflow_email', 0) == 0)
{
watchdog('booking', 'Not sending travelform confirmation email since that feature is currently disabled.');
return;
}
//load the node matching this id from the database, ignoring the cache
$node = node_load($nid, NULL, TRUE);
$tokens = booking_define_personspecific_tokens($node);
watchdog('booking', 'Sending travelform confirmation email to !first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname));
//calculate the from email address
$from = t('!event Travel <!email>', array('!event' => $event->booking_eventname,
'!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
));
//calculate the remaining parameters
$to = $node->booking_email;
$subject = token_replace(variable_get('booking_email_travel_required_subject', t('!event', array('!event' => $event->booking_eventname))), $tokens);
$params['subject'] = $subject;
$params['headers']['Bcc'] = "it@coadcorp.com, " . variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')));
//retrieve the body of the email
$params['body'] = token_replace(variable_get('booking_email_travel_required_text'), $tokens);
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
/**
* Function to generate email to be sent to the attendee once they complete their travel form
*