diff --git a/README.txt b/README.txt
diff --git a/includes/maillog.inc b/includes/maillog.inc
diff --git a/includes/maillog.mail.inc b/includes/maillog.mail.inc
new file mode 100755
index 0000000..9248d99
--- /dev/null
+++ b/includes/maillog.mail.inc
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ * An interface for pluggable mail back-ends.
+ */
+class MaillogMailSystem implements MailSystemInterface {
+  /**
+   * Format a message composed by drupal_mail() prior sending.
+   *
+   * @param $message
+   *   A message array, as described in hook_mail_alter().
+   *
+   * @return
+   *   The formatted $message.
+   */
+   public function format(array $message) {
+     return $message;
+   }
+
+  /**
+   * Send a message composed by drupal_mail().
+   *
+   * @param $message
+   *   Message array with at least the following elements:
+   *   - id: A unique identifier of the e-mail type. Examples: 'contact_user_copy',
+   *     'user_password_reset'.
+   *   - to: The mail address or addresses where the message will be sent to.
+   *     The formatting of this string must comply with RFC 2822. Some examples:
+   *     - user@example.com
+   *     - user@example.com, anotheruser@example.com
+   *     - User <user@example.com>
+   *     - User <user@example.com>, Another User <anotheruser@example.com>
+   *    - subject: Subject of the e-mail to be sent. This must not contain any
+   *      newline characters, or the mail may not be sent properly.
+   *    - body: Message to be sent. Accepts both CRLF and LF line-endings.
+   *      E-mail bodies must be wrapped. You can use drupal_wrap_mail() for
+   *      smart plain text wrapping.
+   *    - headers: Associative array containing all additional mail headers not
+   *      defined by one of the other parameters.  PHP's mail() looks for Cc
+   *      and Bcc headers and sends the mail to addresses in these headers too.
+   *
+   * @return
+   *   TRUE if the mail was successfully accepted for delivery, otherwise FALSE.
+   */
+   public function mail(array $message) {
+   // Log the e-mail
+   if (variable_get('maillog_log', TRUE)) {
+     $record = new stdClass;
+ 
+     $record->header_message_id = isset($message['headers']['Message-ID']) ? $message['headers']['Message-ID'] : NULL;
+     $record->subject = $message['subject'];
+     $record->body = $message['body'][0];
+     $record->header_from = isset($message['from']) ? $message['from'] : NULL;
+     $record->header_to = isset($message['to']) ? $message['to'] : NULL;
+     $record->header_reply_to = isset($message['headers']['Reply-To']) ? $message['headers']['Reply-To'] : '';
+     $record->header_all = serialize($message['headers']);
+     $record->sent_date = time();
+ 
+     drupal_write_record('maillog', $record);
+   }
+ 
+   // Display the e-mail using Devel module
+   if (variable_get('maillog_devel', TRUE) && function_exists('dpm')) {
+     $devel_msg = array();
+     $devel_msg[t('Subject')] = $message['subject'];
+     $devel_msg[t('From')] = $message['from'];
+     $devel_msg[t('To')] = $message['to'];
+     $devel_msg[t('Reply-To')] = isset($message['reply_to']) ? $message['reply_to'] : NULL;
+     $devel_msg[t('Header')] = $message['headers'];
+     $devel_msg[t('Body')] = $message['body'][0];
+ 
+     dpm($devel_msg, 'maillog');
+   }
+   
+   return TRUE;
+   
+  }
+  
+}
diff --git a/includes/maillog.views.inc b/includes/maillog.views.inc
diff --git a/includes/maillog.views_default.inc b/includes/maillog.views_default.inc
diff --git a/includes/maillog_handler_field_maillog_entry_link_delete.inc b/includes/maillog_handler_field_maillog_entry_link_delete.inc
diff --git a/includes/maillog_handler_field_maillog_link_delete.inc b/includes/maillog_handler_field_maillog_link_delete.inc
diff --git a/maillog.info b/maillog.info
old mode 100644
new mode 100755
index 2bfc043..68c5744
--- a/maillog.info
+++ b/maillog.info
@@ -2,4 +2,16 @@ name = Maillog
 description = Utility to log all Mails for debugging purposes. It's possible to suppress mail delivery for e.g. dev or staging systems.
 package = Mail
 dependencies[] = views
-core = 6.x
+core = 7.x
+
+configure = admin/config/development/maillog
+
+files[] = maillog.module
+files[] = maillog.install
+files[] = maillog.info
+files[] = includes/maillog.mail.inc
+files[] = includes/maillog.views.inc  
+files[] = includes/maillog.views_default.inc
+files[] = maillog_handler_field_maillog_entry_link_delete.inc
+files[] = maillog_handler_field_maillog_link_delete.inc
+
diff --git a/maillog.install b/maillog.install
old mode 100644
new mode 100755
index 59a8ed6..ebfa4be
--- a/maillog.install
+++ b/maillog.install
@@ -6,46 +6,13 @@
  */
 
 /**
- * Implementation of hook_requirements().
- */
-function maillog_requirements($phase) {
-  $requirements = array();
-
-  if ($phase == 'runtime') {
-    if (variable_get('smtp_library', '') != drupal_get_path('module', 'maillog') . '/includes/maillog.inc') {
-      $requirements[] = array(
-        'title' => 'Maillog: SMTP Library',
-        'description' => t('SMTP library is not set to use Maillog. To fix the situation, re-enable Maillog in order to reset the SMTP library.'),
-        'severity' => REQUIREMENT_ERROR,
-      );
-    }
-    else {
-      $requirements[] = array(
-        'title' => 'Maillog: SMTP Library',
-        'description' => t('SMTP library is set to use Maillog.'),
-        'severity' => 'REQUIREMENT_OK',
-      );
-    }
-  }
-
-  return $requirements;
-}
-
-/**
- * Implementation of hook_install().
- */
-function maillog_install() {
-  drupal_install_schema('maillog');
-  variable_set('smtp_library', drupal_get_path('module', 'maillog') . '/includes/maillog.inc');
-}
-
-/**
  * Implementation of hook_enable().
  */
 function maillog_enable() {
-  variable_set('smtp_library', drupal_get_path('module', 'maillog') . '/includes/maillog.inc');
-  variable_set('mimemail_engine', 'maillog');
-  variable_set('maillog_engine', 'maillog');
+  $mail_system = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
+  $mail_system['maillog'] = 'MaillogMailSystem';
+  $mail_system['default-system'] = $mail_system['maillog'];
+  variable_set('mail_system', $mail_system);
 }
 
 /**
@@ -57,25 +24,10 @@ function maillog_enable() {
  * when enabling the maillog module, because before restoring when the maillog module gets disabled another module could changed the smtp variable.
  */
 function maillog_disable() {
-  $maillog_smtp_library = drupal_get_path('module', 'maillog') . '/includes/maillog.inc';
-  $smtp_library = variable_get('smtp_library', '');
-  // reset smtp_library settings.
-  if ($smtp_library == $maillog_smtp_library) {
-    variable_set('smtp_library', '');
-  }
-  // reset settings from devel.module
-  $devel_old_smtp_library = variable_get('devel_old_smtp_library', '');
-  if ($devel_old_smtp_library == $maillog_smtp_library) {
-    variable_set('devel_old_smtp_library', '');
-  }
-  variable_del('maillog_engine');
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function maillog_uninstall() {
-  drupal_uninstall_schema('maillog');
+  $mail_system = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
+  unset($mail_system['maillog']);
+  $mail_system['default-system'] = 'DefaultMailSystem';
+  variable_set('mail_system', $mail_system);
 }
 
 /**
@@ -101,25 +53,21 @@ function maillog_schema() {
       'header_from' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'default' => '',
         'description' => t("The 'From' field of the e-mail."),
       ),
       'header_to' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'default' => '',
         'description' => t("The 'To' field of the e-mail."),
       ),
       'header_reply_to' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'default' => '',
         'description' => t("The 'Reply-To' field of the e-mail."),
       ),
       'header_all' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'default' => '',
         'description' => t("The 'Header' field of the e-mail."),
       ),
       'subject' => array(
diff --git a/maillog.module b/maillog.module
old mode 100644
new mode 100755
index 05698db..e33dac6
--- a/maillog.module
+++ b/maillog.module
@@ -17,15 +17,24 @@
  */
 
 /**
- * Implementation of hook_perm().
+ * Implementation of hook_permision().
  */
-function maillog_perm() {
-  return array('view maillog', 'delete maillog', 'administer maillog');
+function maillog_permisson() {
+  return array('view maillog' => array(
+     'title' => t('View Maillog'),
+     'description' => t('Allow users to view a list of recently logged mails.'),
+  ),
+ 'delete maillog' => array(
+     'title' => t('Delete Entries from the log'),
+     'description' => t('Allow users to delete logged mails.'),
+  ),
+    'administer maillog' => array(
+     'title' => t('Administer Maillog'),
+     'description' => t('Allow users to change maillog seetings.'),
+  )
+  );
 }
 
-/**
- * Implementation of hook_menu().
- */
 function maillog_maillog_delete( $maillog ) {
   $idmaillog = $maillog['idmaillog'];
   $result = db_query("DELETE FROM {maillog} WHERE `idmaillog` = '%d'", $idmaillog);
@@ -45,7 +54,7 @@ function maillog_maillog_delete( $maillog ) {
 function maillog_menu() {
   $items = array();
 
-  $items['admin/settings/maillog'] = array(
+  $items['admin/config/development/maillog'] = array(
     'title' => t('Maillog Settings'),
     'description' => t('Configure the settings of Maillog module.'),
     'page callback' => 'drupal_get_form',
@@ -147,50 +156,12 @@ function maillog_admin_settings() {
  */
 function maillog_views_api() {
   return array(
-    'api' => 2,
+    'api' => 3,
     'path' => drupal_get_path('module', 'maillog') . '/includes/',
   );
 }
 
 /**
- * Implementation of hook_mailengine from mimemail modul
- */
-
-function maillog_mailengine($op, $message = NULL) {
-  // default values
-  if (is_array($message)) {
-    $message = array_merge( array(
-        'address' => '',
-        'subject' => '',
-        'body' => '',
-        'sender' => '',
-        'headers' => '',
-      ), $message);
-  }
-
-  switch ($op) {
-    case 'name':
-      return t('Maillog Mail');
-
-    case 'description':
-      return t("Maillog engine using drupal_mail() or another mailengine from maillog_mailengine variable to send mail.");
-
-    case 'settings': // not implemented
-      return FALSE;
-
-    case 'multiple':
-    case 'single':
-    case 'send':
-      $message['from'] = $message['sender'];
-      $message['to'] = $message['address'];
-      unset($message['sender']);
-      unset($message['address']);
-      return maillog_mail_send($message, TRUE);
-    break;
-  }
-}
-
-/**
  * Implementation of hook_theme().
  */
 function maillog_theme() {
@@ -298,105 +269,3 @@ function theme_maillog_body($body) {
 
   return $output;
 }
-
-
-/**
- * Receive a command to send a mail.
- *
- * $message
- * to: recipient
- * from: source
- * $mailengine_call TRUE if function called from maillog_mailengine, otherwise falls. This variable helps to prevent a kind of recursion.
- *
- * @return
- * TRUE on success
- */
-function maillog_mail_send($message, $mailengine_call = FALSE) {
-  // Static variable used to check for recursive mail sending and prevent it
-  static $recursive_send = FALSE;
-
-  if ($recursive_send) {
-    drupal_set_message(t('Maillog has detected recursive mail sending.'), 'warning');
-    return FALSE;
-  }
-
-  $recursive_send = TRUE;
-
-  // Log the e-mail
-  if (variable_get('maillog_log', TRUE)) {
-    $record = new stdClass;
-
-    $record->header_message_id = isset($message['headers']['Message-ID']) ? $message['headers']['Message-ID'] : NULL;
-    $record->subject = $message['subject'];
-    $record->body = $message['body'];
-    $record->header_from = isset($message['from']) ? $message['from'] : NULL;
-    $record->header_to = isset($message['to']) ? $message['to'] : NULL;
-    $record->header_reply_to = isset($message['headers']['Reply-To']) ? $message['headers']['Reply-To'] : '';
-    $record->header_all = serialize($message['headers']);
-    $record->sent_date = time();
-
-    drupal_write_record('maillog', $record);
-  }
-
-  // Display the e-mail using Devel module
-  if (variable_get('maillog_devel', TRUE) && function_exists('dpm')) {
-    $devel_msg = array();
-    $devel_msg[t('Subject')] = $message['subject'];
-    $devel_msg[t('From')] = $message['from'];
-    $devel_msg[t('To')] = $message['to'];
-    $devel_msg[t('Reply-To')] = $message['reply_to'];
-    $devel_msg[t('Header')] = $message['headers'];
-    $devel_msg[t('Body')] = $message['body'];
-
-    dpm($devel_msg, 'maillog');
-  }
-
-  // Send the e-mail
-  $ret = FALSE;
-  if (variable_get('maillog_send', TRUE)) {
-    // note: CORE: we're unable to support further mail wrappers here (function name limit)
-    // We implement mimemail hook_engine for extensibility.
-
-    $mail_sent = FALSE;
-    if ($mailengine_call == TRUE) {
-      $engine = variable_get('maillog_engine', '') .'_mailengine';
-      if (function_exists($engine) && ($engine != 'maillog_mailengine')) {
-        $message['sender'] = $message['from'];
-        $message['address'] = $message['to'];
-        unset($message['from']);
-        unset($message['to']);
-        $ret = $engine('send', $message);
-        $mail_sent = TRUE;
-      }
-    }
-    if ($mail_sent == FALSE) {
-      // build headers
-      $mimeheaders = array();
-      foreach ($message['headers'] as $name => $value) {
-        $mimeheaders[] = $name .': '. mime_header_encode($value);
-      }
-      $mail_headers = join("\n", $mimeheaders);
-      // encode subject
-      $mail_subject = mime_header_encode($message['subject']);
-      // cleanup body
-      $mail_body = str_replace("\r", '', $message['body']);
-      $ret = mail( $message['to'], $mail_subject, $mail_body, $mail_headers);
-    }
-  }
-  else {
-    static $mailwarning = TRUE;
-    if ($mailwarning == TRUE) {
-      if (user_access('administer maillog')) {
-        drupal_set_message(t('Sending of e-mail messages is disabled by Maillog module. Go ' . l('here', 'admin/settings/maillog') . ' to enable.'), 'warning', TRUE);
-      }
-      else {
-        drupal_set_message(t('Drupal tried to send a mail. Note that mails are disabled currently.'), 'warning', TRUE);
-      }
-    }
-    $mailwarning = FALSE;
-    // important: report fake success for sending mail for debugging purposes
-    $ret = TRUE;
-  }
-  $recursive_send = FALSE;
-  return $ret;
-}
diff --git a/maillog_test.bsh b/maillog_test.bsh
