diff --git a/Network/Smtp/Connect.hs b/Network/Smtp/Connect.hs
--- a/Network/Smtp/Connect.hs
+++ b/Network/Smtp/Connect.hs
@@ -18,9 +18,10 @@
     )
     where
 
+import qualified Data.ByteString.Char8 as Bc
 import Control.ContStuff
-import Control.Monad.IO.Peel
-import Control.Exception.Peel as Ex
+import Control.Monad.Trans.Control
+import Control.Exception.Lifted as Ex
 import Network
 import Network.DnsCache
 import Network.Smtp.Simple
@@ -42,7 +43,7 @@
 -- records can be found.
 
 withMxConn ::
-    (Applicative m, DnsMonad m, MonadPeelIO m) =>
+    (Applicative m, DnsMonad m, MonadBaseControl IO m) =>
     Domain -> Bool -> MailT a m a -> m a
 withMxConn domain fallback c = do
     mMx <- resolveMX domain
@@ -51,7 +52,7 @@
           Just (mx:_)   -> return mx
           _ | fallback  -> return domain
             | otherwise -> throwIO $ userError "No MX records for domain"
-    withSmtpConn hostname (PortNumber 25) c
+    withSmtpConn (Bc.unpack hostname) (PortNumber 25) c
 
 
 -- | Connect to the specified SMTP server and run the given computation.
@@ -59,7 +60,7 @@
 -- the given domain.
 
 withSmtpConn ::
-    forall a m. (Applicative m, MonadPeelIO m) =>
+    forall a m. (Applicative m, MonadBaseControl IO m, MonadIO m) =>
     HostName -> PortID -> MailT a m a -> m a
 withSmtpConn host port c =
     Ex.bracket connect (liftIO . hClose) $ \h ->
diff --git a/Network/Smtp/Simple.hs b/Network/Smtp/Simple.hs
--- a/Network/Smtp/Simple.hs
+++ b/Network/Smtp/Simple.hs
@@ -20,7 +20,7 @@
 import qualified Data.Set as S
 import Control.Arrow
 import Control.ContStuff
-import Control.Exception.Peel
+import Control.Exception.Lifted
 import Data.Enumerator
 import Network.Smtp.Tools
 import Network.Smtp.Types
@@ -93,4 +93,4 @@
 sendMail_ ::
     (MailMonad m, MonadIO m) =>
     SendMail -> Iteratee SmtpResponse m a -> (MailConfig, m a)
-sendMail_ cfg = second (>>= either throwIO return) . sendMail cfg
+sendMail_ cfg = second (>>= either (liftIO . throwIO) return) . sendMail cfg
diff --git a/ismtp.cabal b/ismtp.cabal
--- a/ismtp.cabal
+++ b/ismtp.cabal
@@ -1,5 +1,5 @@
 Name:          ismtp
-Version:       4.0.1
+Version:       4.0.2
 Category:      Network
 Synopsis:      Advanced ESMTP library
 Maintainer:    Ertugrul Söylemez <es@ertes.de>
@@ -17,16 +17,19 @@
 
 Library
     Build-depends:
-        base >= 4 && <= 5,
-        bytestring >= 0.9.1.7,
-        containers >= 0.3.0.0,
+        base >= 4 && < 5,
+        bytestring >= 0.9.1,
+        containers >= 0.4.0,
         contstuff >= 1.2.6,
-        dnscache >= 1.0.1,
-        enumerator >= 0.4.7,
-        monad-peel >= 0.1,
+        dnscache >= 1.1.0,
+        enumerator >= 0.4.16,
+        lifted-base >= 0.1.0,
+        monad-control >= 0.3.0,
         netlines >= 1.0.0,
-        network >= 2.2.1.7,
-        vector >= 0.7.0.1
+        network >= 2.2.1,
+        vector >= 0.9
+    Extensions:
+        FlexibleContexts
     GHC-Options: -W
     Exposed-modules:
         Network.Smtp
