diff --git a/simplenews.module b/simplenews.module
index 506c2a0..a1d9c34 100644
--- a/simplenews.module
+++ b/simplenews.module
@@ -409,7 +409,7 @@ function simplenews_node_tab_send_form($form_state, $node) {
         '#value' => key($format_options),
       );
     }
-
+
     // include function that provides the priority values
     module_load_include('inc', 'simplenews', 'includes/simplenews.admin');

@@ -427,13 +427,13 @@ function simplenews_node_tab_send_form($form_state, $node) {
     );
   }
   else {
-
+
     $form['simplenews']['none'] = array(
       '#type' => 'checkbox',
       '#return_value' => 0,
       '#attributes' => array('checked' => 'checked', 'disabled' => 'disabled'),
     );
-
+
     $form['simplenews']['none']['#title'] = ($simplenews_values['s_status'] == SIMPLENEWS_STATUS_SEND_READY) ? t('This newsletter has been sent.') :  t('This newsletter is pending.');
     // We return now, because there's no point in having a submit button
     return $form;
@@ -481,13 +481,13 @@ function simplenews_node_tab_send_form_submit($form, &$form_state) {
   // Get the node
   $values = $form_state['values'];
   $node = node_load($values['nid']);
-
+
   $s_status = SIMPLENEWS_STATUS_SEND_NOT;
   if ($values['simplenews']['send'] == SIMPLENEWS_COMMAND_SEND_NOW) {
     $s_status = SIMPLENEWS_STATUS_SEND_PENDING;
   }
   $values['simplenews']['s_status'] = $s_status;
-
+
   // Is this a multilingual newsletter ?
   // When this node is selected for translation all translation of this node
   // will be sent too.
@@ -1442,7 +1442,35 @@ function simplenews_subscribe_user($mail, $tid, $confirm = TRUE, $source = 'unkn
     $params['from'] = _simplenews_set_from();
     $params['context']['newsletter'] = taxonomy_get_term($tid);
     $params['context']['account'] = $subscription;
-    drupal_mail('simplenews', 'subscribe', $mail, $subscription->language, $params, $params['from']['address']);
+
+    // Send mail
+    if (module_exists('mimemail')) {
+      // If mimemail module is installed ALL emails are send via this module.
+      // drupal_mail() builds the content of the email but does NOT send.
+      $message = drupal_mail('simplenews', 'subscribe', $mail, $subscription->language, $params, $params['from']['address'], FALSE);
+      $to = isset($message['params']['context']['account']) ? $message['params']['context']['account'] : $message['to'];
+      $plain = $message['params']['context']['node']->simplenews['s_format'] == 'plain' ? TRUE : NULL;
+      $mimemail_result = mimemail(
+        $message['from'],
+        $to,
+        $message['subject'],
+        $message['body'],
+        $plain,
+        $message['headers'],
+        $plain ? $message['body'] : simplenews_html_to_text($message['body'], TRUE),
+        isset($message['params']['context']['node']->files) ? $message['params']['context']['node']->files : array(),
+        $message['id']
+      );
+      // Mimemail has changed its API (see http://drupal.org/node/808518) but we keep backward compatibility
+      if (is_array($mimemail_result)) {
+        $message = $mimemail_result;
+      } else {
+        $message['result'] = $mimemail_result;
+      }
+    }
+    else {
+      $message = drupal_mail('simplenews', 'subscribe', $mail, $subscription->language, $params, $params['from']['address'], TRUE);
+    }
   }
   elseif (!isset($subscription->tids[$tid])) {
     // Add user to newsletter relationship if not already subscribed.
@@ -1519,7 +1547,35 @@ function simplenews_unsubscribe_user($mail, $tid, $confirm = TRUE, $source = 'un
     $params['from'] = _simplenews_set_from();
     $params['context']['newsletter'] = $newsletter;
     $params['context']['account'] = $subscription;
-    drupal_mail('simplenews', 'unsubscribe', $mail, $subscription->language, $params, $params['from']['address']);
+
+    // Send mail
+    if (module_exists('mimemail')) {
+      // If mimemail module is installed ALL emails are send via this module.
+      // drupal_mail() builds the content of the email but does NOT send.
+      $message = drupal_mail('simplenews', 'unsubscribe', $mail, $subscription->language, $params, $params['from']['address'], FALSE);
+      $to = isset($message['params']['context']['account']) ? $message['params']['context']['account'] : $message['to'];
+      $plain = $message['params']['context']['node']->simplenews['s_format'] == 'plain' ? TRUE : NULL;
+      $mimemail_result = mimemail(
+        $message['from'],
+        $to,
+        $message['subject'],
+        $message['body'],
+        $plain,
+        $message['headers'],
+        $plain ? $message['body'] : simplenews_html_to_text($message['body'], TRUE),
+        isset($message['params']['context']['node']->files) ? $message['params']['context']['node']->files : array(),
+        $message['id']
+      );
+      // Mimemail has changed its API (see http://drupal.org/node/808518) but we keep backward compatibility
+      if (is_array($mimemail_result)) {
+        $message = $mimemail_result;
+      } else {
+        $message['result'] = $mimemail_result;
+      }
+    }
+    else {
+      $message = drupal_mail('simplenews', 'unsubscribe', $mail, $subscription->language, $params, $params['from']['address'], TRUE);
+    }
   }
   elseif (isset($subscription->tids[$tid])) {
     // Unsubscribe the user from the newsletter.
@@ -1810,7 +1866,7 @@ function simplenews_mail($key, &$message, $params) {
         $subject = token_replace($subject, 'node', $context['node']);
         $subject = str_replace(array("\r", "\n"), '', $subject);
         $message['subject'] = $messages[$nid][$langcode]['subject'] = $subject;
-
+
         // Set the active language to the node's language.
         // This needs to be done as otherwise the language used to send the mail
         // is the language of the user logged in.
@@ -1844,7 +1900,7 @@ function simplenews_mail($key, &$message, $params) {
             'simplenews_newsletter_footer'), $context, $key, $message['language']);
           $messages[$nid][$langcode]['footer'] = $footer;
         }
-
+
         // Reset the language to the original settings.
         if (module_exists('i18n')) {
           i18n_selection_mode('reset');
