com.day.cq.mailer.MailingException: Invalid mail service configuration.

Avatar

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
kiranv40650953
Level 2

07-01-2019

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).

1662195_pastedImage_0.png

I have checked configurations for both which are same and bundle are also mostly same.nly diff i can see is in TEST packmgr

1662200_pastedImage_3.png

and in sandbox packmgr

1662201_pastedImage_4.png

1662207_pastedImage_16.png

Please help me to resolve this issue.

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

07-01-2019

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...

Adobe Experience Manager Help | Creating an Adobe Experience Manager 6.4 custom workflow step that u...

See if this code works for you.

Avatar

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

251 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

251 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile
Gaurav-Behl
MVP

07-01-2019

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.

Avatar

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
kiranv40650953
Level 2

08-01-2019

Hi Smacdonald,

I'm trying to send email from AEM service and I'm using MessageGatewayService API to send emails.

Here is my code

cemail.JPGcemail1.JPG

Please let me know do we need any dependency related to core.wcm.components.all.

Thanks,

Kiran

Avatar

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
kiranv40650953
Level 2

08-01-2019

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.

sandbox.png

test

test.jpg

Let me know if i need to do any changes.

Thanks,

Kiran

Avatar

Avatar
Boost 1
Employee
amitgupta_adbe
Employee

Likes

2 likes

Total Posts

26 posts

Correct reply

8 solutions
Top badges earned
Boost 1
Affirm 5
Affirm 3
Affirm 1
View profile

Avatar
Boost 1
Employee
amitgupta_adbe
Employee

Likes

2 likes

Total Posts

26 posts

Correct reply

8 solutions
Top badges earned
Boost 1
Affirm 5
Affirm 3
Affirm 1
View profile
amitgupta_adbe
Employee

08-01-2019

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

Avatar

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

251 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

251 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile
Gaurav-Behl
MVP

08-01-2019

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 });

      }

Avatar

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
kiranv40650953
Level 2

09-01-2019

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.

1663673_pastedImage_2.png

Please let me know the further.

Thanks,

Kiran

Avatar

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
kiranv40650953
Level 2

Likes

8 likes

Total Posts

32 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
kiranv40650953
Level 2

09-01-2019

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=.

Avatar

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

251 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

251 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile
Gaurav-Behl
MVP

09-01-2019

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?