mirror of
https://github.com/lingble/chatwoot.git
synced 2026-03-20 03:52:43 +00:00
This PR adds the following changes 1. Add `Imap::GoogleFetchEmailService` and `Google::RefreshOauthTokenService`. The `Google::RefreshOauthTokenService` uses `OmniAuth::Strategies::GoogleOauth2` which is already added as a packge 2. Update `Inboxes::FetchImapEmailsJob` to handle Google inboxes 3. Add SMTP settings for Google in `ConversationReplyMailerHelper` to allow sending emails ## Preview #### Incoming emails  #### Outgoing email  --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
18 lines
341 B
Ruby
18 lines
341 B
Ruby
class Imap::GoogleFetchEmailService < Imap::BaseFetchEmailService
|
|
def fetch_emails
|
|
return if channel.provider_config['access_token'].blank?
|
|
|
|
fetch_mail_for_channel
|
|
end
|
|
|
|
private
|
|
|
|
def authentication_type
|
|
'XOAUTH2'
|
|
end
|
|
|
|
def imap_password
|
|
Google::RefreshOauthTokenService.new(channel: channel).access_token
|
|
end
|
|
end
|