Email messages are still in Queue not sent

Hello,

I have a Managed Bean scheduler email task but unfortunately messages are staying in Queue (not sent).
Bellow you have the logfile:
image

cuba.email.smtpAuthRequired = true or false (the same result).
cuba.email.fromAddress = sdss@sddds.com
cuba.email.smtpHost = mail.xxx.com
cuba.email.smtpPort = 25
cuba.email.smtpUser = xxx@yyy.com
cuba.email.smtpPassword = xxxx
cuba.schedulingActive = true

JMX Console emailer it works.

Hi,

Did you enable scheduling?

It should be:

cuba.schedulingActive = true

And you need to set up a scheduled task as described on this manual page.

As you can see above, yes.

image

I already set up a scheduler.

image

Sorry, those log lines say nothing to me about scheduled task setup

What do you want to know exactly?

I use the same address for sender and receiver.
For manual example (logic from controller) it works but for Managed Bean doesn’t.

EmailInfo emailInfo = new EmailInfo(
"xxx@yyy.com", // recipients
“Cotation”, // subject
“Overdue Cotation” + “\n\n” + crmToken + “\n\n” + date,
“text/plain; charset=UTF-8”// the “from” address will be taken from the “cuba.email.fromAddress” app property

    );
    emailService.sendEmailAsync(emailInfo);
}

Hi @neutrino,

Not sure if this will work or if you’ve done it, but it is how I do it.

Create a scheduled task for emailer. See screenshot below:

image

Hi,
I already did. Doesn’t work.
Is mandatory to check singleton box?

Can you help me with an implementation of email method?

Thank you

You’ve set up a scheduler, but I’m not sure what your scheduler is doing.

The image you posted shows that you have a scheduled task bean crmrai_ReminderCheckComponent which calls the Reminder method on schedule.

But I don’t see the call to the Cuba_Emailer.processQueuedEmails() which is the method you need to call to dispatch your queued email messages. Are you calling it inside Reminder?

I use the same setup as @kenince.mbithi, and it works for me.

I am not sure about the singleton box, maybe someone else can help with that. But this is how my email property is like:

cuba.email.fromAddress = DoNotReply@domain.com
cuba.email.smtpHost = smtp.gmail.com
cuba.email.smtpPort = 587
cuba.email.smtpAuthRequired = true
cuba.email.smtpSslEnabled = false
cuba.email.smtpStarttlsEnable = true
cuba.email.smtpUser = myemail@gmail.com
cuba.email.smtpPassword = MyPassword
cuba.email.delayCallCount = 2
cuba.email.messageQueueCapacity = 100
cuba.email.defaultSendingAttemptsCount = 10
cuba.schedulingActive = true

Then I set up the scheduler as above.

Another thing,

  1. Do you have anything on your email history? i.e. Administration > Email History

  2. Are you logging your email scheduler and what is the execution history like? i.e Administration > Scheduled Tasks > Select the cuba_Emailer task > Then Click on Execution History.

Emailer JMX bean works fine. I can send test emails from console (ssl or smtp). In conclusion, I assume the email properties are correct.
Administration > Email History is ok, too. I have sender, receiver, body email, everything, but all emails are in Queue.
Indeed I don’t use Cuba_Emailer.processQueuedEmails() method. Can you give an implementation example?
Thank you!

You don’t need to implement it; it’s part of the framework. You just call it as a scheduled task as shown in @kenince.mbithi’s example. The bean will run on a schedule and check for messages in the queue and dispatch them for you.

Yes I set a scheduler. Scheduling Type cron. At the set time email sequence is sent. Nevertheless I don’t have any issues in deploy/tomcat/log. But all emails stay in queue. Maybe an “emailinfo” object example may be helpful.

I’ll work on an example and share.

Problem solved:

should be used emailService.sendEmail not emailService.sendEmailAsync.

2 Likes