Applicable for versions AEM 6.x
AEM provides OOTB OSGI configuration to enable the mailing service.This service is named as DAY CQ Mailing service. Here the configuration of the SMTP server to be used needs to be added. In this blog, we are going to see how can we use gmail SMTP server to enable the mailing service in AEM.
Following are the steps :
- Goto Configuration manager – http://localhost:port/system/console/configMgr
- Search for the configuration Day CQ Mail Service
- Click on Edit, to setup the configuration. Configure it as shown below –
|SMTP Server Host Name||smtp.gmail.com|
|SMTP Server Port||465|
|SMTP User||<gmail address>|
|SMTP Password||<gmail password>|
|“From” address||<gmail address>|
|SMTP use SSL||Check this|
|SMTP use StartTLS||Don’t check|
|Debug email||Don’t check|
Search for the config file using PID. Check in this config file into configuration code base to persist the configuration even after deployment. [com.day.cq.mailer.DefaultMailService.config]
# Configuration created by Apache Sling JCR Installer smtp.password="secretPassword" debug.email=B"false" smtp.port=I"465" smtp.user="firstname.lastname@example.org" smtp.ssl=B"true" smtp.starttls=B"false" from.address="email@example.com" smtp.host="smtp.gmail.com"
- Save the configuration
- Now go to security options of your above configured gmail account – https://myaccount.google.com/u/1/lesssecureapps?pageId=none
- Set Allow less secure apps as ON
The mail server integration is completed and Day CQ Mail service is active now. You can send emails from AEM instance.