Getting exception while sending mail using Day CQ Mail Service in cloud | Community
Skip to main content
supriya-hande
Level 4
September 13, 2023

Getting exception while sending mail using Day CQ Mail Service in cloud

  • September 13, 2023
  • 3 replies
  • 2336 views

Helllo All,

 

There is custom worklfow process step to send mail using Day CQ Mail Service configs. This is working fine in local AEM sdk setup. But we I deployed these changes to Cloud instance I am getting below error:
com.adobe.granite.workflow.core.job.JobHandler Error executing workflow step
com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error
at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:204) [com.adobe.granite.workflow.core:2.1.104]
at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:300) [com.adobe.granite.workflow.core:2.1.104]
at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:502) [org.apache.sling.event:4.3.8]
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:351) [org.apache.sling.event:4.3.8]
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60) [org.apache.sling.event:4.3.8]
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:287) [org.apache.sling.event:4.3.8]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.day.cq.mailer.MailingException: Invalid mail service configuration.
at com.day.cq.mailer.impl.DefaultMailService.send(DefaultMailService.java:292) [com.day.cq.cq-mailer:5.4.22]
at com.day.cq.mailer.impl.DefaultMailService.send(DefaultMailService.java:46) [com.day.cq.cq-mailer:5.4.22]
at com.hostplus.program.core.services.NotificationMailService.execute(NotificationMailService.java:125) [hostplus-program.core:1.0.0.SNAPSHOT]
at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:198) [com.adobe.granite.workflow.core:2.1.104]

There is one solution to restart com.day.cq.cq-mailer bundle but we dont have access to system console on cloud instance. Anyone is

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

aanchal-sikka
Community Advisor
Community Advisor
September 13, 2023

Hello @supriya-hande 

 

Can you please confirm if you have followed all the steps as described on https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/networking/examples/email-service.html?lang=en

  • Connections to mail services from AEM as a Cloud Service must be proxied out.
  • Ensure the the appropriate advanced networking configuration has been set up 

  • OSGi configuration using proxy

Aanchal Sikka
supriya-hande
Level 4
September 14, 2023

Hi @aanchal-sikka

Thanks for your reply. I followed above link and setup Env variable in cloud manager. I have created OSGI config and provided env values as below:

{
"smtp.host" : "$[env:AEM_PROXY_HOST;default=proxy.tunnel]",
"smtp.port": 30587,
"smtp.user": "$[env:EMAIL_USERNAME]",
"smtp.password" : "$[secret:EMAIL_PASSWORD]",
"smtp.ssl": false,
"smtp.starttls" : true
}
 
But now am getting exception while reading smtp.user value in java:
org.apache.commons.mail.EmailException: javax.mail.internet.AddressException: Local address contains illegal character in string ``$[env:EMAIL_USERNAME]''
I am not getting why this is happening or 
It seems to be using that $[env:… as a string instead of substituting it for the value

aanchal-sikka
Community Advisor
Community Advisor
September 14, 2023

Hello @supriya-hande 

 

Are you getting these errors on local or server?

 

  • On local you would have to use the original settings, what you might have configured.The env variables should work on server.
  • Have you set the variables via cloud manager, for that specific environment, where you are testing? After setting env variables, wait for some time. It takes some time to take effect. I guess you would see some message regarding pods restarting in CM. Don't remember clearly now.
Aanchal Sikka
A_H_M_Imrul
Community Advisor
Community Advisor
September 13, 2023

Hello @supriya-hande,

 

Adding with @aanchal-sikka, can you check the following

- access to the server using SSH

- then try to connect to the smtp server using telnet on the expected port  

telnet smtp.example.com 25

- If you can not connect, you might need to explicitly open the port(s) for any IP (outbound request) on the load balancer. You can raise support ticket for that

 

Thanks

kautuk_sahni
Community Manager
Community Manager
September 18, 2023

@supriya-hande Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni