IMAP sync stages new user if Group.incoming_email is not set to Group.email_username

Thanks @thoka , I had a look into this. I think you are right in that Group.find_by_email needs to have the email_username added to it, but it is not the cause of the group email user getting staged in this case. This actually happens later on in the receiver where we add other addresses to the newly created topic. The important part here is should_invite?

Which in turn compares the email against group_incoming_emails_regex:

I think we will need to make it so in this regex, or another, that we compare against the email_username as well. So far we have not found it a problem that the staged user for the group is made, though I can see that it looks a little messy/unnecessary. I will need to do some testing when I change this to make sure the staged user for the group is not being made for some important currently unknown (to me) reason.

5 Likes