public function send_mail($users, Falcon_Message $message)
{
$options = $message->get_options();
$from = Falcon::get_from_address();
if ($author = $message->get_author()) {
$from = sprintf('%s <%s>', $author, $from);
}
$messages = array();
foreach ($users as $user) {
$data = array('From' => $from, 'ReplyTo' => $message->get_reply_address($user), 'To' => $user->user_email, 'Subject' => $message->get_subject(), 'Headers' => array());
if ($text = $message->get_text()) {
$data['TextBody'] = $text;
}
if ($html = $message->get_html()) {
$data['HtmlBody'] = $html;
}
// Set the message ID if we've got one
if (!empty($options['message-id'])) {
$data['Headers'][] = array('Name' => 'Message-ID', 'Value' => $options['message-id']);
}
// If this is a reply, set the headers as needed
if (!empty($options['in-reply-to'])) {
$original = $options['in-reply-to'];
if (is_array($original)) {
$original = isset($options['in-reply-to'][$user->ID]) ? $options['in-reply-to'][$user->ID] : null;
}
if (!empty($original)) {
$data['Headers'][] = array('Name' => 'In-Reply-To', 'Value' => $original);
}
}
if (!empty($options['references'])) {
$references = implode(' ', $options['references']);
$data['Headers'][] = array('Name' => 'References', 'Value' => $references);
}
$messages[$user->ID] = $this->send_single($data);
}
return $messages;
}