Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

E-Mails in AEM Cloud Service | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

E-Mails in AEM Cloud Service by MARKUS BULLA

Abstract

Sending e-mails from AEM is pretty easy, right?

For “classic” AEM 6.5 you just need the connection details of your mail server along with account credentials, add these as an OSGI configuration for the Day CQ Mail Service to your instance and you’re ready to go. (Curious why this service might be called “Day CQ”? Please refer to my post on AEM history.)

If you are looking at AEM as a Cloud Service, things look a bit different. The official documentation outlines the setup pretty good. This article is going to guide you through the process step-by-step and provide some explanations.

Step 1: OSGI Configuration
Let’s start with the most simple part: telling AEM how to send e-mails. Similar to AEM 6.5, this is handled through an OSGI configuration for the Day CQ Mail Service. In contrast to classic AEM 6.5, there is no way to directly access the Apache Felix web console for AEM CS nor to add or change an OSGI config at runtime. So you need to add an according config file to your code base and deploy it through Cloud Manager to AEM CS. If you are working with the latest Maven AEM Archetype, you should add the configuration to the ui.config module, e. g. as

ui.config/src/main/content/jcr_root/apps/mysite/osgiconfig/config/com.day.cq.mailer.DefaultMailService.cfg.json
The configuration should look like this:

{
"smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]",
"smtp.port": "30002",
"smtp.user": "$[env:EMAIL_USERNAME;default=myEmailId]",
"smtp.password": "$[secret:EMAIL_PASSWORD]",
"from.address": "noreply@wknd.site",
"smtp.ssl": true,
"smtp.starttls": false,
"smtp.requiretls": false,
"debug.email": false,
"oauth.flow": false
}
If you are familiar with e-mail configurations for AEM 6.5, you will notice a couple of things here:

SMTP Host is referencing the predefined and reserved environment variable AEM_PROXY_HOST instead of directly pointing to the target SMTP host.
SMTP Port is pointing to a custom port that needs to be forwarded through advanced network configuration of the AEM CS environment, not the actual target port (e. g. 465 or 587). The port can be freely chosen (from non-restricted ranges) but needs to be reflected when setting up port forwarding in step 3.

Read Full Blog

E-Mails in AEM Cloud Service

Q&A

Please use this thread to ask the related questions.

0 Replies