feat: Support Azure single-tenant application using the Graph API (#6728) (#6878)

This commit is contained in:
Tejaswini Chile
2023-06-28 08:13:08 +05:30
committed by GitHub
parent 4a770fdea7
commit d05c953eef
14 changed files with 451 additions and 13 deletions

View File

@@ -23,6 +23,7 @@ module ConversationReplyMailerHelper
def ms_smtp_settings
return unless @inbox.email? && @channel.imap_enabled && @inbox.channel.provider == 'microsoft'
return ms_graph_settings if ENV.fetch('AZURE_TENANT_ID', false)
smtp_settings = {
address: 'smtp.office365.com',
@@ -40,6 +41,15 @@ module ConversationReplyMailerHelper
@options[:delivery_method_options] = smtp_settings
end
def ms_graph_settings
graph_settings = {
token: @channel.provider_config['access_token']
}
@options[:delivery_method] = :microsoft_graph
@options[:delivery_method_options] = graph_settings
end
def set_delivery_method
return unless @inbox.inbox_type == 'Email' && @channel.smtp_enabled