diff --git a/modoboa/admin/management/commands/handle_mailbox_operations.py b/modoboa/admin/management/commands/handle_mailbox_operations.py index e4da2cb36..663bf3919 100644 --- a/modoboa/admin/management/commands/handle_mailbox_operations.py +++ b/modoboa/admin/management/commands/handle_mailbox_operations.py @@ -25,9 +25,10 @@ class Command(BaseCommand): if not os.path.exists(operation.argument): return new_mail_home = operation.mailbox.mail_home - if not os.path.exists(new_mail_home): + dirname = os.path.dirname(new_mail_home) + if not os.path.exists(dirname): try: - os.makedirs(os.path.dirname(new_mail_home)) + os.makedirs(dirname) except os.error as e: raise OperationError(str(e)) code, output = exec_cmd(