function support_mail in Support Ticketing System 6
Same name and namespace in other branches
- 7 support.module \support_mail()
Implementation of hook_mail().
1 call to support_mail()
- _support_mail_notify in ./
support.module - Use drupal_mail to send email.
File
- ./
support.module, line 1052 - support.module
Code
function support_mail($key, &$message, $params, $html = FALSE) {
$language = $message['language'];
$variables = support_mail_tokens($params['account'], $language, $params['nid'], isset($params['comment']) ? $params['comment'] : array(), $params['suppress'], $html);
$message['subject'] .= _support_mail_text($key . '_subject', $language, $variables, $params['integrate_email']);
$message['body'] = _support_mail_text($key . '_body', $language, $variables, $params['integrate_email']);
// We generate message ids based on comment cids and support nids.
// This allows readers to properly thread the messages coming from us,
// as well as allow us to detect what comment an incoming email is a reply to,
// so we can (optionally) handle threaded comments.
$cid = $params['cid'];
$references = array();
while ($cid) {
$cid = db_result(db_query('SELECT pid FROM {comments} WHERE cid = %d', $cid));
// The last one will be cid 0.
$references[] = _support_generate_message_id($params['nid'], $cid);
}
// Set up message id and threading.
if (!isset($message['headers']['Message-ID'])) {
$message['headers']['Message-ID'] = _support_generate_message_id($params['nid'], $params['cid']);
}
if (!empty($references)) {
$message['headers']['In-Reply-To'] = $references[0];
$message['headers']['References'] = implode(' ', array_reverse($references));
}
}