} $sendresult = array_map('unserialize', array_unique(array_map('serialize', $receiver))); $receivers = count($sendresult); foreach ($sendresult as $address) { if ($gPreferences['mail_into_to'] == 1 || $receivers === 1) { $email->addRecipient($address[0], $address[1]); } else { $email->addBlindCopy($address[0], $address[1]); } } // add confirmation mail to the sender if ($postDeliveryConfirmation == 1) { $email->ConfirmReadingTo = $gCurrentUser->getValue('EMAIL'); } // load the template and set the new email body with template $emailTemplate = admReadTemplateFile('template.html'); $emailTemplate = str_replace('#message#', $postBody, $emailTemplate); // add sender and receiver to email if template include the variables $emailTemplate = str_replace('#sender#', $postName, $emailTemplate); $modulemessages = new ModuleMessages(); $receiverName = ''; if (strpos($ReceiverString, '|') > 0) { $reciversplit = explode('|', $ReceiverString); foreach ($reciversplit as $value) { if (strpos($value, ':') > 0) { $receiverName .= '; ' . $modulemessages->msgGroupNameSplit($value); } else { $user = new User($gDb, $gProfileFields, $value); $receiverName .= '; ' . $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'); } }
} $sendresult = array_map("unserialize", array_unique(array_map("serialize", $receiver))); $receivers = count($sendresult); foreach ($sendresult as $address) { if ($gPreferences['mail_into_to'] == 1 || $receivers == 1) { $email->addRecipient($address[0], $address[1]); } else { $email->addBlindCopy($address[0], $address[1]); } } // add confirmation mail to the sender if ($postDeliveryConfirmation == 1) { $email->ConfirmReadingTo = $gCurrentUser->getValue('EMAIL'); } // load the template and set the new email body with template $emailTemplate = admReadTemplateFile("template.html"); $emailTemplate = str_replace("#message#", $postBody, $emailTemplate); // add sender and receiver to email if template include the variables $emailTemplate = str_replace("#sender#", $postName, $emailTemplate); $modulemessages = new ModuleMessages(); $ReceiverName = ""; if (strpos($ReceiverString, '|') == true) { $reciversplit = explode('|', $ReceiverString); foreach ($reciversplit as $value) { if (strpos($value, ':') == true) { $ReceiverName .= "; " . $modulemessages->msgGroupNameSplit($value); } else { $user = new User($gDb, $gProfileFields, $value); $ReceiverName .= "; " . $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'); } }