diff --git a/admin/tool/messageinbound/classes/edit_handler_form.php b/admin/tool/messageinbound/classes/edit_handler_form.php
index a0bea750aa4..1e5503e3d8b 100644
--- a/admin/tool/messageinbound/classes/edit_handler_form.php
+++ b/admin/tool/messageinbound/classes/edit_handler_form.php
@@ -66,15 +66,24 @@ class tool_messageinbound_edit_handler_form extends moodleform {
         // Items which can be configured.
         $mform->addElement('header', 'configuration', get_string('configuration'));
 
-        $options = array(
-            HOURSECS => get_string('onehour', 'tool_messageinbound'),
-            DAYSECS => get_string('oneday', 'tool_messageinbound'),
-            WEEKSECS => get_string('oneweek', 'tool_messageinbound'),
-            YEARSECS => get_string('oneyear', 'tool_messageinbound'),
-            0 => get_string('noexpiry', 'tool_messageinbound'),
-        );
-        $mform->addElement('select', 'defaultexpiration', get_string('defaultexpiration', 'tool_messageinbound'), $options);
-        $mform->addHelpButton('defaultexpiration', 'defaultexpiration', 'tool_messageinbound');
+        if ($handler->can_change_defaultexpiration()) {
+            // Show option to change expiry only if the handler supports it.
+            $options = array(
+                HOURSECS => get_string('onehour', 'tool_messageinbound'),
+                DAYSECS => get_string('oneday', 'tool_messageinbound'),
+                WEEKSECS => get_string('oneweek', 'tool_messageinbound'),
+                YEARSECS => get_string('oneyear', 'tool_messageinbound'),
+                0 => get_string('noexpiry', 'tool_messageinbound'),
+            );
+            $mform->addElement('select', 'defaultexpiration', get_string('defaultexpiration', 'tool_messageinbound'), $options);
+            $mform->addHelpButton('defaultexpiration', 'defaultexpiration', 'tool_messageinbound');
+        } else {
+            $text = $this->get_defaultexpiration_text($handler);
+            $mform->addElement('static', 'defaultexpiration_fake', get_string('defaultexpiration', 'tool_messageinbound'), $text);
+            $mform->addElement('hidden', 'defaultexpiration');
+            $mform->addHelpButton('defaultexpiration_fake', 'defaultexpiration', 'tool_messageinbound');
+            $mform->setType('defaultexpiration', PARAM_INT);
+        }
 
         if ($handler->can_change_validateaddress()) {
             $mform->addElement('checkbox', 'validateaddress', get_string('requirevalidation', 'tool_messageinbound'));
@@ -107,4 +116,28 @@ class tool_messageinbound_edit_handler_form extends moodleform {
 
         $this->add_action_buttons(true, get_string('savechanges'));
     }
+
+    /**
+     * Return a text string representing the selected default expiration for the handler.
+     *
+     * @param \core\message\inbound\handler $handler handler instance.
+     *
+     * @return string localised text string.
+     */
+    protected function get_defaultexpiration_text(\core\message\inbound\handler $handler) {
+        switch($handler->defaultexpiration) {
+            case HOURSECS :
+                    return get_string('onehour', 'tool_messageinbound');
+            case DAYSECS :
+                    return get_string('oneday', 'tool_messageinbound');
+            case WEEKSECS :
+                    return get_string('oneweek', 'tool_messageinbound');
+            case YEARSECS :
+                    return get_string('oneyear', 'tool_messageinbound');
+            case 0:
+                    return get_string('noexpiry', 'tool_messageinbound');
+            default:
+                    return ''; // Should never happen.
+        }
+    }
 }
diff --git a/admin/tool/messageinbound/index.php b/admin/tool/messageinbound/index.php
index 45d8f7f5b8d..4d1c10c5143 100644
--- a/admin/tool/messageinbound/index.php
+++ b/admin/tool/messageinbound/index.php
@@ -58,8 +58,11 @@ if (empty($classname)) {
     if ($mform->is_cancelled()) {
         redirect($PAGE->url);
     } else if ($data = $mform->get_data()) {
+
         // Update the record from the form.
-        $record->defaultexpiration = (int) $data->defaultexpiration;
+        if ($handler->can_change_defaultexpiration()) {
+            $record->defaultexpiration = (int) $data->defaultexpiration;
+        }
 
         if ($handler->can_change_validateaddress()) {
             $record->validateaddress = !empty($data->validateaddress);
diff --git a/lib/classes/message/inbound/handler.php b/lib/classes/message/inbound/handler.php
index d1d4d9469e5..3c8d7e8904c 100644
--- a/lib/classes/message/inbound/handler.php
+++ b/lib/classes/message/inbound/handler.php
@@ -140,6 +140,18 @@ abstract class handler {
         return $this->validateaddress = $validateaddress;
     }
 
+    /**
+     * Whether the current handler allows changes to expiry of the generated email address.
+     *
+     * By default this will return true, but for some handlers it may be
+     * necessary to disallow such changes.
+     *
+     * @return boolean
+     */
+    public function can_change_defaultexpiration() {
+        return true;
+    }
+
     /**
      * Whether this handler can be disabled (or enabled).
      *
diff --git a/lib/classes/message/inbound/private_files_handler.php b/lib/classes/message/inbound/private_files_handler.php
index 07c63ca1d79..a0eba4071a6 100644
--- a/lib/classes/message/inbound/private_files_handler.php
+++ b/lib/classes/message/inbound/private_files_handler.php
@@ -35,6 +35,15 @@ defined('MOODLE_INTERNAL') || die();
  */
 class private_files_handler extends handler {
 
+    /**
+     * Email generated by this handler should not expire.
+     *
+     * @return bool
+     */
+    public function can_change_defaultexpiration() {
+        return false;
+    }
+
     /**
      * Return a description for the current handler.
      *
diff --git a/lib/db/messageinbound_handlers.php b/lib/db/messageinbound_handlers.php
index 05e1ae8b2a6..f5edb8795ba 100644
--- a/lib/db/messageinbound_handlers.php
+++ b/lib/db/messageinbound_handlers.php
@@ -27,6 +27,6 @@ defined('MOODLE_INTERNAL') || die();
 $handlers = array(
     array(
         'classname' => '\core\message\inbound\private_files_handler',
-        'defaultexpiration' => null,
+        'defaultexpiration' => 0,
     ),
 );
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index df4e681b43c..70a96d10d57 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -4113,5 +4113,15 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2014120102.00);
     }
 
+    if ($oldversion < 2015010800.01) {
+
+        // Make sure the private files handler is not set to expire.
+        $DB->set_field('messageinbound_handlers', 'defaultexpiration', 0,
+                array('classname' => '\core\message\inbound\private_files_handler'));
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2015010800.01);
+    }
+
     return true;
 }
diff --git a/version.php b/version.php
index e40503811e5..d910555afb5 100644
--- a/version.php
+++ b/version.php
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version  = 2015010800.00;              // YYYYMMDD      = weekly release date of this DEV branch.
+$version  = 2015010800.01;              // YYYYMMDD      = weekly release date of this DEV branch.
                                         //         RR    = release increments - 00 in DEV branches.
                                         //           .XX = incremental changes.