cancel
Showing results for 
Search instead for 
Did you mean: 

BTP destination configuration to send email using Office 365

Giampaolo
Participant
0 Kudos
3,703

Hi,
I'm trying to send email from a Build Process Automation workflow.

I created sap_process_automation_mail destination as below, but it doesn't work.

Type			MAIL
Proxy Type Internet
Authentication OAuth2Password
User <user_email>
Password <user_pwd>
Client ID <Application ID (client)>
Client Secret <client secret value>
Token Service URL https://login.microsoftonline.com/<Tenant_ID>/oauth2/v2.0/token

- - - ADDITIONAL PROPERTIES - - -
mail.bpm.send.disabled false
mail.smtp.auth true
mail.smtp.auth.mechanisms XOAUTH2
mail.smtp.from <user_email>
mail.smtp.host smtp.office365.com
mail.smtp.port 587
mail.smtp.ssl.checkserveridentity true
mail.smtp.ssl.enable false
mail.smtp.ssl.trust *
mail.smtp.starttls.enable true
mail.smtp.starttls.required true
mail.transport.protocol smtp
scope https://graph.microsoft.com/SMTP.Send

How can i solve?

Thanks in advance,
Giampaolo

View Entire Topic
tobias_breyer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

the https://outlook.office.com/SMTP.Send scope is the one to use. You can see from this Microsoft documentation that it is the outlook-one they recommend:

I don't think that the issue relates to the scope configuration in the destination, but it must be the correct one above and the user must have the scope. So maybe also check all the ways of limiting the scope on Azure side.

The 'scope' configuration property of the destination is just to reduce the token scope to exactly that scope (leaving out unnecessary scopes, reducing exposure of scopes the user has). So in case you specify the wrong scope, the token won't have a suitable scope at all. But if you specify the correct scope, it will just let the necessary things go through.

Please note that there is a documentation gap on the above page, the SMTP.SendAsApp scope is for the Client Credentials flow (which is not yet supported by SAP Build Process Automation). The page mentioned, in a historic version (use pencil icon on top right), the scope from above.

Unfortunately, the Test SMTP Server Configuration dialog does not detail out the authentication issues.

If you have the possibility, you could check what error message you get when you use a mail notification. It uses the sap_process_automation_mail, unless the bpmworkflowruntime_mail destination exists (in scenarios coming from SAP Workflow Management). In case of failure, you might receive better error messages in the respective process monitoring.

For some of them, you find trouble-shooting on the bottom of the product documentation page on SMTP configuration.

Hope that helps,

Tobias