diff --git a/mimemail.inc b/mimemail.inc
index f01259f..efee46b 100644
--- a/mimemail.inc
+++ b/mimemail.inc
@@ -132,8 +132,10 @@ function _mimemail_file($url = NULL, $content = NULL, $name = '', $type = '', $d
   static $filenames = array();
 
   if ($url) {
+    $linkonly = variable_get('mimemail_linkonly', 0);
+    $image = preg_match('!\.(png|gif|jpg|jpeg)$!i', $url);
     // The file exists on the server as-is. Allows for non-web-accessible files.
-    if (@is_file($url)) {
+    if (@is_file($url) && $image && !$linkonly) {
       $file = $url;
     }
     else {
