Skip to Content
1
Mar 15, 2023 at 07:08 AM

Cloud SDK mail-client send using On Premise SMTP MAIL Destination

13157 Views

Hi,

i was super excited to learn about the new Mail Client in Cloud SDK and wanted to include it in our solution but failed. So I went over Ahmet's Blog post and tried it in this simple setup (BAS, new CAP project with the single endpoint, new service instances on my trial account and using "cds bind" to test it from BAS) but I still cannot figure it out.

According to the docs, using an On Premise mail server should be as simple as configuring a destination with proxy type "OnPremise" and Cloud SDK would handle the SOCKS5 proxy. So I configured our CC with a Cloud To On-Premise Mapping of a virtual system "mail.server.com:25" to our internal mail server also running on Port 25 (TCP).

I then created the following destination:

mail-destination.png

using "mail.smtp.starttls.enable: true" and "mail.transport.protocol: smtp" for the non-readable properties (Mail server accepts un-authenticated, non-TLS requests on port 25 originating from our internal network. I have to set BasicAuthentication since NoAuthentication is rejected by mail-client#buildMailDestination. Using the same parameters without Authentication does in fact work with Java using the template from https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/using-tcp-protocol-for-cloud-applications?locale=en-US).

However, cloud sdk complains that "The proxy configuration is undefined, which is mandatory for creating a socket connection" (Source of Error).

So I started to debug the destination and stumbled upon the connectivity-service#addProxyConfigurationOnPrem method that seems to provide the expected Socks proxy to the destination, but that method is not invoked. Turns out that destination-service-types#isHttpDestination evaluates to "false" as the MAIL destination has no url and the type is set, which in turn results in destination-from-service#getDestinationFromDestinationService to skip the addition of the proxy setting.

So my question is: am I even correct to use a destination of Type "MAIL" with Proxy Type "OnPremise", setting mail.smtp.host to the virtual host of the CC and mail.smtp.port to the port? Or did I stumble upon an issue with the new mail client and destination service combination?
Since I tried to "fix" the isHttpDestination method to add the proxy on MAIL Destinations as well but still run into an error (namely a ECONNRESET), I'm not sure anymore....

Best
Martin

Attachments