fmbiete / Z-Push-contrib

Z-Push fork with changes that I will try to contrib
GNU Affero General Public License v3.0
134 stars 61 forks source link

Problem retrieving Spam folder #250

Open basbebe opened 8 years ago

basbebe commented 8 years ago

I have problems retrieving the contents of my Spam folder on an iOS device. It is called "Junk" and I set the IMAP config define('IMAP_FOLDER_SPAM', 'JUNK');. However on an iPhone I don't see any messages in that folder and get an error after a few second. I already did a resync.

Dovecot doesn't throw any errors and Z-Push doesn't tell me anything obvious either. Anything I might check? Thanks!

basbebe commented 8 years ago

I changed the name back to define('IMAP_FOLDER_SPAM', 'SPAM');

Now it works. Seems like I misinterpreted the comments and used the IMAP folder name and not the name the iPhone expects to find…

fmbiete commented 8 years ago

No, your interpretation was correct. It's the IMAP server name.

That's an iOS bug. I suppose it has hardcoded that the SPAM folder name is "SPAM", and it's not looking at the flags z-push puts. So, if you have a SPAM folder named Junk, iOS won't recognise it. I would say that you now have a Junk and Spam folder in your account.

basbebe commented 8 years ago

These are my IMAP mailboxes:

root@mail:~/ > doveadm  mailbox list -u mail@xxx.yy
Sent
Drafts
Trash
Notes
Archive
Junk
INBOX

And this is my config.php

// Since I know you won't configure this, I will raise an error unless you do.
// When configured set this to true to remove the error
define('IMAP_FOLDER_CONFIGURED', true);

// Folder prefix is the common part in your names (3, 4)
define('IMAP_FOLDER_PREFIX', '');

// Inbox will have the preffix preppend (3 & 4 to true)
define('IMAP_FOLDER_PREFIX_IN_INBOX', false);

// Inbox folder name (case doesn't matter) - (empty in 4)
define('IMAP_FOLDER_INBOX', 'INBOX');

// Sent folder name (case doesn't matter)
define('IMAP_FOLDER_SENT', 'SENT');

// Draft folder name (case doesn't matter)
define('IMAP_FOLDER_DRAFT', 'DRAFTS');

// Trash folder name (case doesn't matter)
define('IMAP_FOLDER_TRASH', 'TRASH');

// Spam folder name (case doesn't matter). Only showed as special by iOS devices
define('IMAP_FOLDER_SPAM', 'SPAM');

// Archive folder name (case doesn't matter). Only showed as special by iOS devices
define('IMAP_FOLDER_ARCHIVE', 'ARCHIVE');

// forward messages inline (default true - inlined)
define('IMAP_INLINE_FORWARD', true);

// list of folders we want to exclude from sync. Names, or part of it, separated by |
// example: dovecot.sieve|archive|spam
define('IMAP_EXCLUDED_FOLDERS', '');

It works that way – the "Spam" folder on the iOS device is being synced with the "Junk" folder of the IMAP server…

fmbiete commented 8 years ago

Try this:

define('IMAP_FOLDER_SPAM', 'Junk');

It that works, iOS is case sensitive for that folder. And SPAM would work because as Junk doesn't match it will be passed as is to the phone (without changing the case).

basbebe commented 8 years ago

Seems to work now even with JUNK