create the Drafts folder for users so K-9 mail doesn't poll unnecessarily, see #129
This commit is contained in:
parent
b56f82cb92
commit
e294f7c181
|
@ -89,7 +89,9 @@ def add_mail_user(email, pw, env):
|
||||||
# write databasebefore next step
|
# write databasebefore next step
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
# Create the user's INBOX and Spam folders and subscribe them.
|
# Create the user's INBOX, Spam, and Drafts folders, and subscribe them.
|
||||||
|
# K-9 mail will poll every 90 seconds if a Drafts folder does not exist, so create it
|
||||||
|
# to avoid unnecessary polling.
|
||||||
|
|
||||||
# Check if the mailboxes exist before creating them. When creating a user that had previously
|
# Check if the mailboxes exist before creating them. When creating a user that had previously
|
||||||
# been deleted, the mailboxes will still exist because they are still on disk.
|
# been deleted, the mailboxes will still exist because they are still on disk.
|
||||||
|
@ -100,8 +102,9 @@ def add_mail_user(email, pw, env):
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return ("Failed to initialize the user: " + e.output.decode("utf8"), 400)
|
return ("Failed to initialize the user: " + e.output.decode("utf8"), 400)
|
||||||
|
|
||||||
if "INBOX" not in existing_mboxes: utils.shell('check_call', ["doveadm", "mailbox", "create", "-u", email, "-s", "INBOX"])
|
for folder in ("INBOX", "Spam", "Drafts"):
|
||||||
if "Spam" not in existing_mboxes: utils.shell('check_call', ["doveadm", "mailbox", "create", "-u", email, "-s", "Spam"])
|
if folder not in existing_mboxes:
|
||||||
|
utils.shell('check_call', ["doveadm", "mailbox", "create", "-u", email, "-s", folder])
|
||||||
|
|
||||||
# Update things in case any new domains are added.
|
# Update things in case any new domains are added.
|
||||||
return kick(env, "mail user added")
|
return kick(env, "mail user added")
|
||||||
|
|
Loading…
Reference in New Issue