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 #3ā€¦ Outbound 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.