private function _send($pid, $email) { if (is_string($email)) { $email = array($email); } $parsed = $this->_parse($pid); $mailer = new Mailer(); $emails = array(); $decorated = array(); $template = new Template(); $tpl = $template->getUserTemplate(); foreach ($email as $em) { if (is_string($em)) { $emails[] = $em; } else { $emails[] = $em->email; $decoration = array('{email}' => $em->email, '[email]' => $em->email, '[code]' => $em->activationcode, '{code}' => $em->activationcode); if ($tpl) { foreach ($tpl->fields as $field) { if (isset($em->content->{$field->label})) { $decoration['[' . $field->label . ']'] = $em->content->{$field->label}->tpl; } } } $decorated[$em->email] = $decoration; } } if (count($decorated) == 0) { $decorated = null; } $mailer->sendMassMail(array(MAILINGFROM => SITENAME), $emails, $parsed->page->content->loc_title, $parsed->parsed, $decorated); }