diff --git a/smtp.module b/smtp.module
index c8d9c82..093199c 100644
--- a/smtp.module
+++ b/smtp.module
@@ -679,10 +679,19 @@ function smtp_drupal_mail_wrapper($message) {
             }
             // If plain/html within the body part, add it to $mail->Body.
             elseif (strpos($body_part2, 'text/html')) {
+              // Get the encoding.
+              $body_part2_encoding = _smtp_get_substring($body_part2, 'Content-Transfer-Encoding', ' ', "\n");
               // Clean up the text.
               $body_part2 = trim(_smtp_remove_headers(trim($body_part2)));
-              // Include it as part of the mail object.
-              $mail->Body = $body_part2;
+              // Check whether the encoding is base64, and if so, decode it.
+              if (drupal_strtolower($body_part2_encoding) == 'base64') {
+                // Include it as part of the mail object.
+                $mail->Body = base64_decode($body_part2);
+              }
+              else {
+                // Include it as part of the mail object.
+                $mail->Body = $body_part2;
+              }
               $mail->ContentType = 'multipart/mixed';
             }
           }
