Expand my Community achievements bar.

Send Out Email with AEM Servlet | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

Send Out Email with AEM Servlet by Sourcedcode

Abstract

In this article, we will be setting up the local AEM author developer’s environment to send out an email utilizing the Day CQ Mail Service. This article includes code snippets to a Sling Servlet that will be used to send out the email.

We will be using a Google Gmail account as the SMTP Mail Server in this article. To learn how to set up your Google Gmail account as the SMTP server, click here.
1. Configure the Day CQ Mail Service
a. Visit http://localhost:4502/system/console/configMgr/com.day.cq.mailer.DefaultMailService

This is a screenshot of the Apache Felix Console, Day CQ Mail Service Configuration

b. Include the configurations below:
Google SMTP Configurations
SMTP server hostname: smtp.gmail.com
SMTP server port: 465, 25 or 587 (test in that order)
SMTP user: @@YOUR_EMAIL_ADDRESS@@
SMTP from emai: @@YOUR_EMAIL_ADDRESS@@
SMTP password: @@YOUR_PASSWORD@@
SMTP TLS/SSL: true

To automate this configuration, you can run a Curl command like the example below. But please be aware, you must use your own Google Gmail account.

To update the Curl command below, use this tool here, Tool: Generate Curl Command to Update OSGI Configurations

curl -u admin:admin 'http://localhost:4502/system/console/configMgr/com.day.cq.mailer.DefaultMailService' --data-raw 'apply=true&action=ajaxConfigManager&%24location=&smtp.host=smtp.gmail.com&smtp.port=587&smtp.user=contact@sourcedcode.com&smtp.password=p4ssw0rd&from.address=contact@sourcedcode.com&smtp.ssl=true&propertylist=smtp.host%2Csmtp.port%2Csmtp.user%2Csmtp.password%2Cfrom.address%2Csmtp.ssl'

Read Full Blog

Send Out Email with AEM Servlet

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
0 Replies