diff --git a/advuser.module b/advuser.module
index 78b5a2a..4386617 100644
--- a/advuser.module
+++ b/advuser.module
@@ -5,6 +5,7 @@
  * filtering and apply actions to block, unblock, delete or email the selected
  * users.
  *
+ * $Id: advuser.module,v 1.14.2.9 2009/06/23 15:33:25 earnie Exp $
  **/
 
 /**
@@ -44,8 +45,7 @@ function advuser_menu() {
     'description' => t('List, add, edit and email users.'),
     'page callback' => 'advuser_admin', 
     'page arguments' => array('list'), 
-    'access callback' => 'advuser_admin_access',
-    'access arguments' => array('access advuser', 'administer users'),
+    'access arguments' => array('access advuser'),
     'type' => MENU_LOCAL_TASK,
     'file' => 'advuser_filters.inc',
   );
@@ -73,20 +73,6 @@ function advuser_admin($callback_arg = '') {
   return $output;
 }
 
-function advuser_admin_access() {
-  $accesses = func_get_args();
-  if (empty($accesses)) {
-    $accesses = array('access advuser');
-  }
-  foreach ($accesses as $access) {
-    $ret = user_access($access);
-    if (!$ret) {
-      break;
-    }
-  }
-  return $ret;
-}
-
 function advuser_admin_account() {
   $filter = advuser_build_filter_query();
   $header = array(
@@ -165,9 +151,7 @@ function advuser_admin_account() {
     $form['roles'][$account->uid][0] = array('#value' => theme('item_list', $users_roles));
     $form['member_for'][$account->uid] = array('#value' => format_interval(time() - $account->created));
     $form['last_access'][$account->uid] =  array('#value' => $account->access ? t('@time ago', array('@time' => format_interval(time() - $account->access))) : t('never'));
-    if (module_exists('profile')) {
-      profile_load_profile($account);
-    }
+    module_invoke('profile', 'load_profile', $account);
     foreach(advuser_profile_fields() as $field) {
       $form[$field->name][$account->uid] = array('#value' => profile_view_field($account, $field));
     }
@@ -434,6 +418,21 @@ function advuser_multiple_email_confirm_submit($form, &$form_state) {
  * Implementation of hook_mail
  */
 function advuser_mail($key, &$message, $params) {
+
+    if (variable_get('advuser_html_email', 0)) {
+
+        $headers = array(
+            'MIME-Version' => '1.0',
+            'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
+            'Content-Transfer-Encoding' => '8Bit',
+            'X-Mailer' => 'Drupal'
+        );
+
+        foreach ($headers as $key => $value) {
+            $message['headers'][$key] = $value;
+        }
+    }
+    
   $message = array_merge($message, $params);
 }
 
@@ -449,6 +448,13 @@ function advuser_settings() {
     '#collapsed' => FALSE,
   );
 
+  $form['advuser_mail']['advuser_html_email'] = array(
+            '#type' => 'checkbox',
+            '#title' => t('Enable send email in HTML format'),
+            '#description' => t('Activating this option the email will be send using HTML format'),
+            '#default_value' => variable_get('advuser_html_email', 0),
+  );
+
   $form['advuser_mail']['variables'] = array(
     '#type' => 'markup', 
     '#prefix' => '<div class="advuser-inset-panel">',
