JKB
27 September 2022 17:15
#1
Hi
I have successfully set up my GMAIL account as IMAP to view within Suite. I can view my inbox and my sent items perfectly well by going to ALL - Emails then selecting the relevant folder.
If I select an email from my inbox and then import it, the correct email is imported into Suite and attached as a record.
If I select an email from my Sent items an incorrect email is being imported and attached as a record.
Just wondering if anyone else has experienced this?, or if anyone can test to see if they get the same behaviour or indeed if anyone knows what the issue may be.
Thanks in anticipation.
My version info below
Version 7.11.6
Sugar Version 6.5.25 (Build 344)
JKB
9 December 2022 08:54
#2
Hi - hoping there is someone out there that can help with this problem. See original post from 27/09
Thanks
Jim
pgr
9 December 2022 16:18
#3
Email is messy with SuiteCRM but luckily for all of us, the next version will have a much improved interface to configure inbound email.
When this PR goes into a release, try that release:
salesagility:develop
← clemente-raposo:feature/emails-oauth
opened 04:17PM - 05 Dec 22 UTC
<!--- Please be aware that as of the 31st January 2022 we no longer support 7.10… .x.
New PRs to hotfix-7.10.x will be invalid. If your fix is still applicable to 7.12.x,
please create the pull request to the hotfix branch accordingly. -->
## Description
#### Update External OAuth Connection Module
- Add config.php entry to allow adding oauth external providers
- Add ExternalOAuthConnection module to allow getting access through OAuth from external providers
- Allow setting up Security groups for ExternalOuthConnections Emails



#### Update Inbound Emails Module
- Update Inbound email module views to user regular view defs
- Allow creating Personal, Group and Bounce emails through InboundEmails create/edit view
- Remove inbound email configuration from profile view configurations
- Allow setting up Security groups for Inbound Emails
- Allow selecting between basic auth and oauth on inbound email configuration
- Allow selecting an external oauth connection as the connection to use for authenticating in Inbound emails





#### Update Outbound Emails Module
- Allow creating Personal outbound emails through Outbound email module create/edit view
- Remove outbound email configuration from profile view configurations
- - Allow setting up Security groups for Outbound Emails


#### Update IMAP connection library | Allow connecting with xoauth
- Add imap2 lib to handle in order to support xoauth login in imap
- Add Imap2Handler to be used to connect to IMAP for Oauth connections
https://user-images.githubusercontent.com/1140849/205695529-099579bd-d24a-4564-a5ef-659bbd03e4fb.mp4
## Motivation and Context
- Allow connecting to IMAP using OAuth connections
- Fix some bugs in current inbound and outbound email Configuration
## How To Test This
1. Configure a Microsoft connection provider using the following config.php configuration
```php
'external_oauth_providers' => [
'Microsoft' => [
'type' => 'Generic',
'client_id' => '<TO-REPLACE>',
'client_secret' => '<TO-REPLACE>',
'redirect_uri' => 'http://<TO-REPLACE>/index.php?entryPoint=setExternalOAuthToken',
'authorize_url_options' => [
'scope' => 'offline_access IMAP.AccessAsUser.All SMTP.Send User.Read',
],
'extra_provider_params' => [
'scopes' => 'offline_access imap.accessasuser.all smtp.send user.read',
'urlAuthorize' => 'https://login.microsoftonline.com/<TO-REPLACE>/oauth2/v2.0/authorize',
'urlAccessToken' => 'https://login.microsoftonline.com/<TO-REPLACE>/oauth2/v2.0/token',
'urlResourceOwnerDetails' => '',
'verify' => false
],
'get_token_request_grant' => 'authorization_code', // optional
'get_token_request_options' => [], // optional
'token_mapping' => [ // optional
'access_token' => 'access_token',
'expires_in' => 'expires_in',
'refresh_token' => 'refresh_token',
'token_type' => 'values.token_type'
]
],
],
```
2. Go to Profile > External OAuth connection module and create new personal connection
3. Select Microsoft > Click Authenticate > Popup should appear
4. Add your credentials > Authorize > Connection fields should be field in with token information
5. Add a name > Save
6. Go to InboundEmail record
7. Change Auth Type from basic to OAuth
8. You should be able to see the records you and the ones you have access to by security groups
9 . Select a record > Save > The record should correctly save
10. Go to emails module. You should be able to see the emails sorted by received date
11. Try the filter panel you should be able to filter
12. You should not be able to sort or set sorting direction
13. You should be able to mark emails as read and unread
14. You should be able to flag and un-flag emails
15. You should be able to delete emails
16. You should be able to import emails
17. you should be able to go to the email detail view page
18. You should be able to see the email information in the detail view page
19 Configure a group inbound emails. You will need to create a group ExternalOauthConnection
20. Auto email import for cases should work for group emails
21. Inbound email repair should work
## Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to change)
### Final checklist
- [x] My code follows the code style of this project found [here](https://docs.suitecrm.com/community/contributing-code/coding-standards/).
- [x] My change requires a change to the documentation.
- [x] I have read the [**How to Contribute**](https://docs.suitecrm.com/community/contributing-code/) guidelines.