function siteaccess_notify_user($user, $type)
{
    global $CONFIG;
    if ($user && $user instanceof ElggUser) {
        if ($email = siteaccess_get_email($type)) {
            $subject = siteaccess_parser($user, $email->title);
            $content = siteaccess_parser($user, $email->description);
            $result = notify_user($user->guid, $CONFIG->site->guid, $subject, $content, NULL, 'email');
            return $result;
        }
    }
    return false;
}
</div>
</div>

<div class="email_details">
<p><a class="collapsibleboxlink">[<?php 
echo elgg_echo('siteaccess:email:label:validated');
?>
]</a></p>
<div class="collapsible_box">
    <?php 
$email = siteaccess_get_email('validated');
$form_body = elgg_view('siteaccess/email', array('email' => $email));
echo elgg_view('input/form', array('action' => "{$vars['url']}action/siteaccess/email/save", 'body' => $form_body));
?>
</div>
</div>

<div class="email_details">
<p><a class="collapsibleboxlink">[<?php 
echo elgg_echo('siteaccess:email:label:notifyadmin');
?>
]</a></p>
<div class="collapsible_box">
    <?php 
$email = siteaccess_get_email('notify_admin');
$form_body = elgg_view('siteaccess/email', array('email' => $email));
echo elgg_view('input/form', array('action' => "{$vars['url']}action/siteaccess/email/save", 'body' => $form_body));
?>
</div>
</div>