diff --git a/src/Mailgun/Api/Message.php b/src/Mailgun/Api/Message.php
index 0114d65..201ecb7 100644
--- a/src/Mailgun/Api/Message.php
+++ b/src/Mailgun/Api/Message.php
@@ -82,7 +82,7 @@ class Message extends HttpApi
         $params['to'] = $recipients;
         $postDataMultipart = $this->prepareMultipartParameters($params);
 
-        if (is_file($message)) {
+        if (strlen($message) < PHP_MAXPATHLEN && is_file($message)) {
             $fileData = ['filePath' => $message];
         } else {
             $fileData = [
diff --git a/tests/Api/MessageTest.php b/tests/Api/MessageTest.php
index d42485f..bcb64fb 100644
--- a/tests/Api/MessageTest.php
+++ b/tests/Api/MessageTest.php
@@ -111,6 +111,17 @@ class MessageTest extends TestCase
         $api->show('url', true);
     }
 
+    public function testSendMimeWithLongMessage()
+    {
+        $api = $this->getApiMock();
+        $api->expects($this->once())
+            ->method('httpPostRaw')
+            ->willReturn(new Response());
+
+        $message = str_repeat('a', PHP_MAXPATHLEN).' and some more';
+        $api->sendMime('foo', ['mailbox@myapp.com'], $message, []);
+    }
+
     /**
      * {@inheritdoc}
      */