cancel
Showing results for 
Search instead for 
Did you mean: 

Email Trigger Issue with OAuth2Password Authentication in SAP CAPM

adarsh-kmr
Explorer
0 Kudos
162
Hi Experts,
We were previously using an email destination with Basic Authentication, and it was working as expected. However, as you're aware, Basic Authentication has been deprecated in Office 365, so we have now updated the authentication type to OAuth2Password.
After this change, we are unable to trigger emails from our SAP CAP application.
Error Message: The destination 'name: sap_process_automation_mail' does not contain host or port information as properties. Please configure in the "Additional Properties" of the destination. 
If anyone has encountered a similar scenario or has insights into this issue, your suggestions or assistance would be greatly appreciated.
Thanks in advance for your support.
View Entire Topic
gregorw
SAP Mentor
SAP Mentor
0 Kudos

The documentation for the destinationsap_process_automation_mail can be found at Configure an SMTP Mail Destination. If you can confirm that this issue also occurs with SAP Build Process Automation you should file an issue via SAP Support. If you need support how to use this destination with CAP please post more details how you call the destination.

adarsh-kmr
Explorer
0 Kudos

Hi @gregorw, Thanks for the response.

The below code was working fine for BasicAuth:

const { sendMail } = require('@sap-cloud-sdk/mail-client');

module.exports = srv => {
srv.on("sendmail", async (req) => {
const { to, subject, text } = req.data;
const mailConfig = {
from: 'example@sap.com',
to: to,
subject: subject,
text: text
};

try {
await sendMail({ destinationName: 'sap_process_automation_mail' }, [mailConfig]);
return 'Email sent successfully.';
} catch (error) {
console.log(error);
return 'Something went wrong!';
}
});
};

 

When I updated the authentication type to OAuth2Password, it started throwing error: The destination 'name: sap_process_automation_mail' does not contain host or port information as properties. Please configure in the "Additional Properties" of the destination. 

Also, I'm able to trigger emails using BPA>Control Tower(OAuth2Password destination). 

gregorw
SAP Mentor
SAP Mentor