Hi guys,
I'm facing mail configuration issue in AEM 6.4.2 only in TEST(no sample content) but not in sandbox(with sample content).
I have checked configurations for both which are same and bundle are also mostly same.nly diff i can see is in TEST packmgr
and in sandbox packmgr
Please help me to resolve this issue.
Solved! Go to Solution.
Views
Replies
Total Likes
Since, you have visually validated the configs from OSGi console, existence of sample packages should not cause an issue.
Here are the few items you can try:
- Verify that the port is open on server using telnet <smtp_host> <smtp_port>
- Refresh/Restart "com.day.cq.cq-mailer" bundle
Are you trying to send email from an AEM Service. If so - you should use the MessageGatewayService API. It works fine. See this example that uses this API to send email messages. There is also a video...
See if this code works for you.
Hi Smacdonald,
I'm trying to send email from AEM service and I'm using MessageGatewayService API to send emails.
Here is my code
Please let me know do we need any dependency related to core.wcm.components.all.
Thanks,
Kiran
It seems that you are using a custom smtp host to send emails. Check if that host is available ? Telnet on port 25 on that box itself-
telnet <hostname> 25
The error says invalid mail service configuration which means either hostname, user/pass, etc. is not configured or read properly. If possible, check line #270 of DefaultMailService.java and that's the rootcause. Compare the configurations of your sandbox vs this server.
Hi Gaurav,
I'm using custom smtp host to send emails and which is available.
Configuration for sandbox and test are same.Below are the screenshots.
test
Let me know if i need to do any changes.
Thanks,
Kiran
You should enable debug logs com.day.cq.mailer.impl
and observe the logs when DefaultMailService is getting activated.
It should print the configuration debug message in activation method
"MailService activated, fromAddress"
Or check logs for messages like
"Invalid mail service configuration"
"No mail service configuration present."
also check the component com.day.cq.mailer.DefaultMailService in components web console (/system/console/components), see if you see the configuration properties for
Hi Amit,
I have debug the logs and i can see bellow message
09.01.2019 07:10:15.575 *DEBUG* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.cq.mailer.DefaultMailService)] com.day.cq.mailer.impl.DefaultMailService MailService activated, fromAddress=aem@...
and i have also checked com.day.cq.mailer.DefaultMailService in components which is active and below are the configurations.
Please let me know the further.
Thanks,
Kiran
Below is the code in DefaultMailService that is throwing exception. The configuration object is null. Check bundle/properties/environment options.
Cfg cfg = this.cfg;
if (null == cfg) {
throw new MailingException("Invalid mail service configuration.");
}
Enable debug and check what is unavailable -
if (log.isDebugEnabled()) {
log.debug("MailService activated, fromAddress={}, smtpHost={}, smtpPort={}, debugEmail={}, smtpUser={}.", new Object[] { this.cfg.fromAddress, this.cfg.smtpHost, Integer.valueOf(this.cfg.smtpPort), Boolean.valueOf(this.cfg.debugEmail), this.cfg.smtpUser == null ? "" : this.cfg.smtpUser });
}
HI Gaurav,
I have checked bundle and log for com.day.mailer
09.01.2019 07:10:15.575 *DEBUG* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.cq.mailer.DefaultMailService)] com.day.cq.mailer.impl.DefaultMailService MailService activated, fromAddress=aem@xyz.com, smtpHost=mailhub.xyz.com, smtpPort=25, debugEmail=true, smtpUser=.
Could you try with a different smtp-host and from-address?
Are these both servers (the one which works fine and other which doesn't work) setup on same box? Is it win/linux? Can you do telnet on these boxes to check if smtp-host and the host of your from-address are available?
Hi Gaurav,
We have access for only this host.In same box we have AEM 6.3 and 6.4 and In 6.3 it is working fine.Those are in linux machine.
I have done ping command to host and those are available.
Please let me know further
Thanks,
Kiran
I'm afraid that ping wouldn't help here, we need telnet to check if smtp port #25 is open or not. The host may be available on your local machine but not on the box where AEM is setup.
ping would simply check the communication line is working but it wouldn't check specific port# on that box itself.
Could you get it validated with your network team?
telnet <hostname> 25
Since, you have visually validated the configs from OSGi console, existence of sample packages should not cause an issue.
Here are the few items you can try:
- Verify that the port is open on server using telnet <smtp_host> <smtp_port>
- Refresh/Restart "com.day.cq.cq-mailer" bundle
Views
Likes
Replies
Views
Likes
Replies