Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


SOLVED How does spam work with special mail folders?

  • Staff

    The symlinks will stick around. They are not part of the backups though. So you have to re-create the symlinks if you restore cloudron to another server.

    I got the symlink idea from here https://wiki.dovecot.org/SharedMailboxes/Symlinks . I tried it on my server and it does work. Works quite nicely on thunderbird because it doesn't auto-subscribe to Spam folder by default even (so I don't have to adjust my spam settings for new accounts).



  • @imc67 That SO post is great, I had seen that many years ago when running a mail server before and couldn't find it to raise in this forum. haha. Thanks for finding that!

    @girish Per the RFC mentioned in that first response to the OP in SO, it indicates that the folder really should be named "Junk", not "Spam", and I think this is partly the root cause of why the default Mail app in macOS and iOS do not see it by default - because it's following RFC and expecting the folder to be named "Junk".

  • Staff

    The folder name is different from the special_use flags. The RFC is suggesting the use of the "\junk" flag. This is what Cloudron also does. The mailbox name is not suggested in the RFC AFAICT. Can you tell me which section you are referring to?


  • @girish Ah, I believe you are correct there. I think I just typically see the names the same so I mixed them up. I still think though that it should be named "Junk" instead of "Spam" as that is what I have used in the past and it works well. Even your Thunderbird screenshot indicates they expect it to be named "Junk" too as they don't use the word "Spam". Of course that's just my interpretation and past experience, but I believe you're correct that this isn't a defined requirement in the RFC.

    I really think admins should have more control over this, such as setting up their own default folder list, for example, or the ability to mark multiple folders as '\Junk' and the ability to remove the Spam folder in favour of naming it Junk.

  • Staff

    @d19dotca said in How does spam work with special mail folders?:

    I really think admins should have more control over this, such as setting up their own default folder list, for example, or the ability to mark multiple folders as '\Junk' and the ability to remove the Spam folder in favour of naming it Junk.

    I can get behind this. But I am quite practical about these things. There's nothing we can do to fix iOS and mac, so I am OK to even rename the folder to Junk if it increases compatibility. In the coming release (5.3), I have put some "state" information that will help us migrate to the release after. Existing installations can be on Spam and new installations can use Junk. I am doing the same for the mailbox separator. (moving things from . to / to make mailbox sharing work).


  • @girish said in How does spam work with special mail folders?:

    OK, here's a workaround for iOS.

    • SSH into server and create symlink from Junk to Spam
      # cd /home/yellowtent/boxdata/mail/vmail/{mailboxname}/mail
      # ln -s .Spam .Junk`
      # docker restart mail
    

    You have to do above for all mailboxes. This will make both Spam and Junk folder identical and they will both appear in mail clients (unfortunate...). But atleast, it will make iOS client work.

    We are looking into migrating the folder names for a future Cloudron release (there is a bug that we used "." as the separator in folder names. this makes ACLs and shared mailboxes unviable). Maybe at that time, we can look into making these folder names more customizable.

    BTW there's similar "problem" for "Sent" / "Sent Messages" and "Trash" / "Deleted Messages"...


  • @necrevistonnezr True. The difference though is at least it can be worked around on iOS and macOS as you can set the folder roles. Can’t do that with spam/junk folder unfortunately.

    023320FE-4EBE-4DA6-B8E9-19FF089D4B93.jpeg


  • @girish said in How does spam work with special mail folders?:

    OK, here's a workaround for iOS.

    • SSH into server and create symlink from Junk to Spam
      # cd /home/yellowtent/boxdata/mail/vmail/{mailboxname}/mail
      # ln -s .Spam .Junk`
      # docker restart mail
    

    @girish Wouldn't it make sense to create hardlinks instead of symlinks for these folders so that you don't have duplicate folders? Ar am I overlooking something?

  • Staff

    @necrevistonnezr said in How does spam work with special mail folders?:

    @girish Wouldn't it make sense to create hardlinks instead of symlinks for these folders so that you don't have duplicate folders? Ar am I overlooking something?

    The cloudron backup logic does not understand hardlinks. It would then end up taking backup of your junk folder twice. This is unlike symlinks which is ignored by the backup code. Neither the symlink nor the contents of a symlink are backed up.

    This does bring up an important point that if you move your mail server to a different server, you have to remember to create this symlink by hand again!