Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

MessageGatewayService is null

Avatar

Avatar
Validate 1
Level 2
alexandrad27705
Level 2

Likes

2 likes

Total Posts

19 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 2
alexandrad27705
Level 2

Likes

2 likes

Total Posts

19 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
alexandrad27705
Level 2

05-04-2016

Hi, 

I've configured the Day Email Server with my Gmail email, which works because I am receiving workflow emails via this Gmail account, so the configuration is correct. 

But I am trying to send a campaign email newsletter and the MessageGatewayService always comes back with null.

In my class I reference the service:

@Reference
    public static MessageGatewayService messageGatewayService;

And then want to retrieve it via:

MessageGateway messageGateway = messageGatewayService.getGateway(HtmlEmail.class);

I found that quite some people have had the same issue but I couldn't find any solutions. 

Anyone have an idea what is going wrong?

Any help is very appreciated!

Thanks, 

Alex

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 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,408 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

06-04-2016

Just tested on 6.1

Make sure you specify the correct SMTP server, port and SMTP user and password., 

Answers (3)

Answers (3)

Avatar

Avatar
Applaud 5
Level 3
anjali_biddanda
Level 3

Likes

23 likes

Total Posts

88 posts

Correct Reply

8 solutions
Top badges earned
Applaud 5
Give Back 10
Ignite 1
Validate 10
Validate 1
View profile

Avatar
Applaud 5
Level 3
anjali_biddanda
Level 3

Likes

23 likes

Total Posts

88 posts

Correct Reply

8 solutions
Top badges earned
Applaud 5
Give Back 10
Ignite 1
Validate 10
Validate 1
View profile
anjali_biddanda
Level 3

09-06-2021

@alexandrad27705 Restarting the com.day.cq.cq-mailer bundle in the environment was the solution that worked for me.

 

The MessageGatewayService contains a hashSet of gateways. If you delete or move your Day CQ Mail Service configuration, a new gateway is added to the hashSet. The messageGatewayService.getGateway() only retrieves one DefaultMailService from the hashSet, and it could be one with cfg null inside, although there exists one configured correctly. Only way to clean this up is by restarting the bundle. 

 

Any subsequent updates to theDefaultMailService config work fine. This only happens when you delete/move your config in your environment.

Avatar

Avatar
Level 1
SG-x3LqsS
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
SG-x3LqsS
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
SG-x3LqsS
Level 1

30-06-2016

I'm trying with the code in that article. I'm using AEM 6.1 and used my gmail account for smtp configuration. For me, the MessageGateway is not null but it still doesn't send email, it doesn't throw any error either. Wondering how do I debug this further?

Thanks for your help!

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 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,408 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

06-04-2016

For testing purposes - do you have another email server to test with. I have never had an issue with MessageServiceGateway, but I am wondering if there is an issue with GMail SMTP server.