 .../commands/MailhandlerCommandsFiles.class.php    |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php b/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php
index 74314ef..0408ac2 100644
--- a/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php
+++ b/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php
@@ -16,7 +16,12 @@ class MailhandlerCommandsFiles extends MailhandlerCommands {
       // 'unnamed_attachment' files are not really attachments, but mimeparts like HTML or Plain Text.
       // We only want to save real attachments, like images and files.
       if ($attachment->filename !== 'unnamed_attachment') {
-        $destination = 'temporary://';
+        $destination = variable_get('mailhandler_temporary_path', 'temporary://');
+        // Make sure the path ends with a '/'.
+        if (substr($destination, -1) != '/') {
+          $destination .= '/';
+        }
+
         $filename = mb_decode_mimeheader($attachment->filename);
         $file = file_save_data($attachment->data, $destination . $filename);
         $file->status = 0;
