Integrating an Email Service with SAP Commerce Cloud
4 min read
Sending emails to your customers is an important requirement for any commerce solution. SAP Commerce Cloud gives you the flexibility to choose the email option that best suits your business needs. In this article, we cover how emails are created in SAP Commerce Cloud, the comparison between the email integration of SAP Commerce Cloud on public cloud vs. on SAP infrastructure, and the options for integrating with an email provider.
Table of Contents
SAP Commerce Cloud uses its WCMS module to define and generate emails, leveraging WCMS components that are rendered within the email text. Sending emails is a business process that contains a sequence of actions and is defined in a process definition XML file.
SAP Commerce Cloud on SAP Infrastructure E-Mail Services
Each Commerce Cloud environment (Dev, Staging, Production) has its own SMTP Relay server for sending transactional emails. Additionally, Commerce uses the Apache Commons Email library under the hood of the Commerce Platform. Please see the diagram below:
SAP Commerce Cloud in the Public Cloud E-Mail Services
The Cloud Build Platform does not offer an SMTP relay server. Therefore, you will need to need to provide an alternative that fits your business needs when it comes to sending transactional emails. Currently, there are two recommended approaches:
- Host your own SMTP server. You will need to rely on a hosted SMTP server in order to send transactional emails. That means installing, configuring, monitoring, and maintaining this server will be your responsibility.
- Leverage a 3rd Party SMTP Service. There are many 3rd party providers for SMTP relay service. Most new
SMTP Relay Services providers (SaaS) offer both SMTP API and REST
API to send e-mails.
Out-bound firewall rules are set to allow any outgoing traffic, which means white-listing is not required for consuming external services.
The current SAP Commerce implementation provided by
acceleratorservices extension is
It does not support any protocol other than SMTP. SMTP Interface is typically connected
via TCP port 587 or 443.
This gives you the ability to integrate with a trusted 3rd-party SMTP Relay Service or to host your own SMTP Relay server.
Setting Up Email
The MailUtils Utility from the Commerce Platform core extension is used to send emails. It relies on Apache Commons Email (and Java Mail API underneath) to send transactional e-mails.
Another option is to build an to add to
Commerce Accelerator Services the support for sending transactional emails by consuming APIs other
than the SMTP. For example, REST API. The action of sending an e-mail is delegated
EmailSendStrategy implementation that makes the necessary API calls.
Support for additional providers can be implemented since most of them provide a Java client library, which reduces most of the development.
There are many options for email providers and with SAP Commerce Cloud you can select the option that suits your needs. When you are considering an email provider, it is important to account for both the features that come with the service and any potential customization work that will allow emails to function properly within your SAP Commerce Cloud solution.