Cannot set inbound group email for non-Administrator users

SuiteCRM version: 7.13.3

Hello,
I am trying to configure one group e-mail (marketing) for all users of the CRM.
I was able to properly configure it on the Administrator account, and the inbound e-mail is working.
However, when I set the inbound e-mail for any other user (admin or not) from the Administrator account in admin > users > email settings, the e-mail:
-shows up in the list for admin users, but if I log into them and go to my e-mails, the view is blank (F12 reveals a javascript error:
“Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data”
the relative line is the following:
" let query = JSON.parse($(‘[name=current_query_by_page]’).val());")
-does not show up for non-admin users, then shows up when I click on “–nothing–”, but if I select the inbound mail and save, when I edit again it’s not there anymore, as though I never selected it. If I go to the e-mails tab while logged in as any of them, the same parse error is revealed by F12 on a blank page

I was able to get the e-mail to work on other admin users by changing the email settings while being logged in as them and changing their own e-mail settings, however once the users went back to being non-admin (they aren’t supposed to be admins) the view for e-mails was blank once again.

I have tried manually adding the relationship in the folders_subscriptions table, which didn’t work.

I have read all threads mentioning “inbound email” on this forum, none of which solved my issue.

If you need any more information, I’ll be happy to provide it.

1 Like

Hi @gp_lnuff, welcome to the Community! :tada:

@pstevens do you think what he described is the same thing you were working on recently?

Thanks!

I forgot to mention, the line of the javascript error is in the “/modules/Emails/include/ListView/ListViewHeader.js” file

@pgr YES!

The whole implementation of Group Email was a bit of a mess.

  1. Group email accounts do not get marked as “is_group”= 1 in the database so they are not selected properly throughout SuiteCRM (I fixed this).
  2. Subscriptions do not get added to users because it only runs when “is_group”=1 (I fixed this). You’ll also have to re-save the accounts once the patch is applied to update the subscriptions and the “is_group”
  3. Only admins can see group accounts because the filter of available accounts do not take into account subscriptions but only if the user is an admin. (I fixed this) Now the user can see folders subscribed to AND that he/she has access to.
  4. The JS that generates the list in the user preferences cannot handle a second array of group accounts in the JSON list, so they cannot be selected for viewing in the selection list. (I fixed this). (this one is nasty in the cache and difficult to fix, you’ll have to R&R all the js files after the patch)
  5. Deleted group accounts get shown too! There is no mechanism when an email account is deleted to mark it as deleted =1. (I fixed this)

Long story short, there are a bunch of fixes that need to be applied to make they whole system of Group Emails work.

All the required fixes are listed here (there are about 4-5 changes that need to be made to various files):

Also, don’t forget to add the user and the group account to the same security group. If you check out my super long post on this one, there is a video demonstrating 1. It not working and 2. working after the patches and how it works.

1 Like

Thank you very much for you reply, after following your post I was able to implement the changes and get the group email working for users added to my security group.
My last question is whether the changes are upgrade safe or not, do I need to add the modified files to the “custom” folder?

Edit: I should mention, I was still unable to select the inbound email (which correctly shows up as a group email on the database, with is_group set to 1) from email settings in admin > users, and had to manually insert the relationships in folder_subscriptions from the database, is there something I missed to get the group email to show up in email settings? I R&R’d the JS files and everything else is working properly

Edit 2: After deleting from the “folders” and “folders_subscriptions” tables and reconfiguring the group email, I was able to get it to show up in email settings, however, the --none-- option is showing up twice (which seemed to be one of the minor issues one of the fixes aimed to fix. I should also mention this was not happening to me before implementing the fixes). Selecting the inbox and saving is still not generating an entry in the folders_subscriptions table.

Edit 3: I’ve encountered a couple other issues while trying to get email-settings to work as intended by the fixes:

  • mass deleting records in “inbound email accounts” in admin does not flag the records as deleted on the “folders” table in the database

  • After applying the fixes, testing connection settings for the e-mail seems to brick the crm and requires clearing the browser’s cache to log back in and keep working (as administrator, unsure how it affects other users logged into the crm)

  • After reconfiguring the group e-mail, subscriptions are automatically generated for Administrator, however, Administrator is incapable of vieweing the inbound email even after selecting the inbox folder

Thanks for the info glad its mostly working:

re: mass deleting, sounds like another bug. I’ll have to research that on too. Like I said group emails is a mess. It’s like an onion. Every layer of problems you peel off reveals another layer of problems. Probably why no one wanted to touch it in the past LOL.

re: email freezing. This is another bug not related to group emails. There is a bug and patch about once you test it works, but after you save, the password is not saved and the email account does not work. I suspect this is the issue you’re having. There is a patch and fix on github. It was probably working prior to re-saving, but once you re-saved you encountered the bug.

re: Admin viewing. This absolutely works. I have it working in multiple test env. Make sure the Admin is “subscribed” in the admins users settings. If you still have problems let me know and I’ll do some more testing. Also, maybe the previous bug about the password could be a factor. There are no emails to see because the connection to IMAP is broken.

Try this to see if it fixes problem #2 and #3Outbound email test does not use correct password after save · Issue #9457 · salesagility/SuiteCRM · GitHub

1 Like

Thank you for the reply,

I implemented the fixes as described in issue #9457, however that didn’t seem to help with either the e-mail freezing on test, or letting Administrator view the inbox (which is understandable, as the issue is about outbound e-mail whereas the group e-mail I’m trying to setup is inbound).

I have some more information about the behaviour I encountered:

  • testing the inbound email doesn’t straight up freeze the crm, it actually yields a 504 gateway error. I was able to go back to the home page by closing my window, opening another one, and waiting patiently after the 504 occurred (without flushing browser cache, that is)

  • the record for the group e-mail I’m testing is a DIFFERENT RECORD from the one I initially had working on Administrator (I made absolutely sure to copy the same settings exaclty)

  • Administrator is definitely subscribed to the inbox folder, as I manually selected it from user settings (it is visible) and I can choose it in the mail tab if I click on the blank gray button on the right. I can also see the relationships in the “folder_subscriptions” table. However, it will show up as blank. This could be, as you mentioned, an issue with the imap configuration not being saved properly by the crm. You mentioned there being a fix for this on github? It seems to be a different issue from the one you posted.

Lastly, again, is it ok for me to be implementing these changes on the crm files themselves rather than going through the customization framework?

Thank you for your time

Hey yes, these changes will have to be implemented in the core files and then re-implemented any time you update (unless they make it into a future update).

PS - I’ve just tested again. As admin I can see all group email inboxes and their contents.

I suspect you have a connection issue. Can the users see the inboxes?

Here is the actual code that needs to be changed:

PS - The behavior of this bug is exactly as you describe. It hangs trying to connect to the email server and then times out.

1 Like

I see, thank you

This group mail is the only e-mail on the CRM, there are no personal inbound e-mail accounts. If you’re asking whether the e-mail is working, it’s working normally outside of the CRM

I was able to find that page before and I’ve implemented the commits, however my issue with testing the inbound email connection persists.

My issue may lie a step before that though - when I have to select a folder to check when inserting the record (the mandatory field), I did not select it from the popup (I was unable to, it was blank) I wrote the name of the folder manually. That could be the issue behind the connection testing, but then there’s the issue of the popup not showing me any folders to select from. I apologize for being potentially misleading

EDIT: Turns out since the last time the record was made (around a year ago), the IMAP password had changed and we weren’t notified… (I found this out after trying to personally log into the webmail and not being able to…) with the new password I was able to select the folders on record creation, Administrator was able to see the inbox. However, selecting the inbox from the users’ email settings still isn’t generating the record in the “folder_subscriptions” table. After manually adding the records, the users are able to see the inbox as well. So the only missing piece from the fix is the generation of the relationships when selecting the folder in the email settings.

Only the user can select the folders. It does work. I’ve tested that. The admin cannot select the folders for the user (I’m guessing that’s maybe what happened in your case). The user has to log in and select the folders they want to see. The admin governs which folders they are allowed to see via security groups.

1 Like

I thought email settings were strictly part of the admin module - I was able to find the user’s profile settings while logged in as the user and changing email settings while logged in as the user sure works! Thank you very much for the fixes, the guidance and the patience!

1 Like

Awesome, thanks for testing it out. If it eventually gets pushed into the core I’ll make a video explaining how it all works, because there’s lots of moving parts!

PS - Thanks for finding another issue re:

  • mass deleting records in “inbound email accounts” in admin does not flag the records as deleted on the “folders” table in the database

Just for clarity, do you mean mass deleting inbound email accounts, or mass deleting inbound email records (ie the actual emails)?

PS - I just tested deleting IMAP emails from the folder and it absolutely deleted them. I’m thinking maybe this was an issue of your IMAP connection not actually connecting. Can you confirm?

I encountered the issue when mass deleting inbound email accounts, I haven’t tried deleting any e-mails.

@gp_lnuff Ok great, I’ll test that later and see if I experience the same. It could be that the delete.php doesn’t get called correctly from the mass delete button vs, the delete button in the record.