diff --git a/modules/mimemail/mimemail.inc b/modules/mimemail/mimemail.inc
index cad4852..248523b 100644
--- a/modules/mimemail/mimemail.inc
+++ b/modules/mimemail/mimemail.inc
@@ -113,7 +113,7 @@ function _mimemail_replace_files($matches) {
  *   The actual file content.
  *
  * @return
- *   The Content-ID and/or an array of the files on success or the URL on failure. 
+ *   The Content-ID and/or an array of the files on success or the URL on failure.
  */
 function _mimemail_file($url = NULL, $content = NULL, $name = '', $type = '', $disposition = 'related') {
   static $files = array();
@@ -557,8 +557,14 @@ function _mimemail_url($url, $embed_file = NULL) {
   }
 
   $url = str_replace('?q=', '', $url);
-  list($url, $fragment) = explode('#', $url, 2);
-  list($path, $query) = explode('?', $url, 2);
+
+  $pieces = explode('#', $url, 2);
+  $url = $pieces[0];
+  $fragment = isset($pieces[1]) ? $pieces[1] : NULL;
+
+  $pieces = explode('?', $url, 2);
+  $path = $pieces[0];
+  $query = isset($pieces[1]) ? $pieces[1] : NULL;
 
   // If we're dealing with an intra-document reference, return it.
   if (empty($path) && !empty($fragment)) {
