Mailing Issue in AEM with Gmail SMTP Configuration

In this post, I will sort out a small but important issues that most of the developer faced while they are doing mailing service configuration in AEM with Gmail SMTP settings. Here is the problem description-
 
“Author have done email configuration in AEM with Gmail SMTP configuration values, all configuration values are right but email functionality is still not working”
 
In this post I will show you, all required steps for Email configuration in AEM and also tell you if you miss any step then what error you will get. So let’s start.
 

Step 1.

 
Go to Felix Console —> Configuration Tab —> search for Day CQ Mail Service
Click on this configuration, fill the values as shown below-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
If you are using port 465 then you have to select SMTP use SSL checkbox else mailing will not work because, for 465 port, this configuration is mandatory.
 
Step 2:
 
You need to set the email Id for users.
Go to useradmin console, here is the URL – http://localhost:4502/useradmin
 
Add email Id for that user for example I am doing for admin user as shown below.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Don’t forget to save this modification.
 
I will test mailing service using a test workflow. There is only one process step with no operation (Script) process. Here are the workflow images.
 
 
 
 

Save your workflow.
 
open any geometrixx page. 

 

 
Go to workflow tab
 
Select test workflow
 
Click on start
 
Check your user mail account.
 
Have you got the mail?
 
Some Answers – Yes
Some Answers – No
 
 
 
 
Why no?
 
Either you have entered wrong credentials or you are getting an exception. For exception check error.log file. If you are getting an error as described below-
 
com.day.cq.workflow.impl.email.EMailNotificationService error while sending email for null: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:25
 
Then you need to make a small change at your Gmail account security settings.
 
 
You will get a scree, as shown below-
 
 
 
 
 
 
 
 
 
 
 
 
Turn On this setting and test your workflow again. Now you are able to see notification mail in your Gmail account.

 

Happy Coding
Namah Shivay