Resend undelivered emails

Hi,

I had read that the undelivered emails go in the folder WEB-INF\lucee\remote-client\open as .tsk files. We had a problem with our mail server and now I would like to send them. I searched on the forum and I found that I need to go in the server admin or web admin in the Service - Tasks section. But when I go there, there is no task : There are currently no open tasks

How can I resend them?

Thank you!

OS: Windows Server 2016 (10.0) 64bit
Java Version: 1.8.0_181 (Oracle Corporation) 64bit
Tomcat Version: Apache Tomcat/8.5.33
Lucee Version: Lucee 5.3.8.206

I have no idea if this helps for Lucee, since it sounds like it uses a different approach. But, I remember in Adobe ColdFusion, if you had undelivered emails, you could just dump the physical files back into the “spool” directory, and they would automatically get sent … at least, I’m pretty sure that was true. But, again, no idea if that applies to Lucee.

1 Like

Hi Ben,

We were indeed used to Adobe Coldfusion and the folder you are talking about, but according to my research on the forum, Lucee does not have this same functionality.

Ahh, sorry :confused:

@TonyMonast If you have spool enable turned off in admin or async attribute false in mail tag means undelivered mails are not going for spooling by task manager and throws an error in the request page. Does your mail request throw an error on the request page?. Otherwise, those undelivered mails are available on the web-admin services-task page.

you can turn on the spool enable in the admin services-mail page http://localhost:8888/lucee/admin/server.cfm?action=services.mail

Hi cfmitrah,

The spool enable is turned on and there is no error in the request page. I did look at the services - tasks section and it says There are currently no open tasks.

I have a question related to it. Today, all the undelivered emails started to be send by Lucee without any intervention from our side. Can we delete the .tsk in the folder WEB-INF\lucee\remote-client\open without causing any trouble? And why Lucee started to send them? Is it like a 24 hours retry delay?

Thank you

Are you sure you were looking in the right web context admin?

In my experience, yes.

I’m pretty sure yes. I looked in server admin and web admin under Services - Tasks.

As @Julian_Halliwell suspected, I was not looking in the right web context. Problem solved.

2 Likes

To add to this, I have the same issue.
I have number of .tsk files sitting in the /open folder.
Both Server and Web Tasks pages show no tasks.

Did you see the correct web context admin tasks page for undelivered mails?

For example: If you have undelivered mails in the myDomain.test.com web context means those undelivered mails are doesn’t available in the localhost:8888 web context tasks page.

Lucee 5.3.8.201 - Windows 10 install.

Thanks for the reply.
I’m testing this on a VM with a multi-instance install of Lucee.

This test site is on localhost:8892 and I’m using PaperCut SMTP to test handle the emails.

My code test fires off 600 emails - these go into the {site}\WEB-INF\lucee\remote-client\open directory - I can seem them spool there and get removed as they are sent and come through Papercut.

If I change the settings of Papercut, e.g. it’s IP address or port so as to interrupt the emails being sent, I can see that they now stop being removed from the \open directory and remain there as tasks but checking both Server and Web versions of Lucee Admin at localhost:8892, the Tasks page on both is empty.

Returing Papercut to default settings still leaves the emails in the folder - even though the text against the Mail Timeout setting suggests that “…the Task Manager will pick it up later to try to send it again”

Sending a couple of new emails just adds them to the folder without them now being sent. Verifying the mail connections makes no difference, email is just sitting there.

Restarted both Papercut and Lucee services but still the emails are not sent.

I.e. it seems Lucee doesn’t handle unsent email.

Edit: Just left it whilst doing something else - emails have now gone through about an hour later - what mechanism/timing decides that???

Edit2: Tried it again, 600 emails, stopped the PaperCut service after 50 emails has come through. Still nothing in the Tasks page whether Server or Web. Restarted the PaperCut service after a few minutes and now the remaining emails are coming through after about 10 minutes. So what controls when they are resent?

Roughly 40 of them failed to go through this second time but can see their modified date has changed to ‘now’ so I assume they’ve been updated with failure notices - logs show email send timeouts - still nothing on the Tasks pages though.

20 minutes later those 40 emails are still sitting there. I’ve sent another email in the meantime, that has come through but left the others there. What/when decides to resend them?

ColdFusion is really good at creating and sending an email, but its NOT an email server.

Create your email using the cfmail tag as normal
set your email to send via a RELAY server
The “RELAY” server is literally any SMTP mail server that handles all the RFC email sending compliance for you.
Plenty of documentation out there and plenty of servers that will do this. Even the email server that ships with XAMPP will work for this.

Why does this happen, there are many reasons, but most of then having everything to do with the other server not wanting to directly TALK to your instance of Lucee for a variety of their own criteria and security concerns.

Thanks for the reply. So the problem here potentially lies more with me testing via PaperCut than Lucee?

I’m still not seeing the unsent tasks though and I’m led to believe they should be showing in the Tasks list? Also, those 40 calls outstanding are still sitting there with the same modified dates which suggests Lucee hasn’t ‘touched’ them to attempt a resend since?

EDIT: Okay, they’ve just gone, exactly an hour since the file timestamp suggested they were last attempted. So this 60 minutes must be a retry value somewhere? Any idea where so I can look at testing a lower value?

The issue has more to do with HOW emails works than ColdFusion.

A mail server would just move them it its mail queue then send them in accordance with what it was configured to do, and what the other server may have asked it to wait. Typically mail retries start out at 5 seconds, 2 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 6 hours, 8 hours, 12 hours, 24 hours, 2 days for most configurations.

My suggestion for the relay server is if you have large jobs or you have an issue where someone spams the hell out of your box by using fake email addresses, you will clog up your server with bad emails. Its better to pass them off to a mail server where you can do something with your good and bad email, and that includes backup routes to other smtp delivery services. Yes you can do that programmatically as well, but its far more efficient at the email server level

Thanks. Surely though this still shows the issue is on the Lucee side. In my test I’m effectively simulating the mail relay/server becoming unavailable by stopping the Paper Cut service - Lucee is unable to send it’s emails so they stay in the Open folder and, according to the documentation it will retry at a later time - it doesn’t say what “later” equates to though…
“…the Task Manager will pick it up later to try to send it again”

I then re-enable the mail relay/server by restarting Paper Cut - it’s there and ready to take emails again and Lucee does send the newly created email but the unsent emails remain and it waits for exactly 60 minutes before attempting to send them again. This is the Lucee side, not the mail server.

Where is that 60 minute retry timer set in Lucee? If I could lower it to say 10 minutes, all would be fine.

And the emails are still not showing in the Tasks area of the Admin which, according to many, is where they should show. Again, this is a Lucee issue, whether bug or configuration.

Edit: Can see a “spool-interval” value in the lucee-server.xml - set to “5” in this case - can’t see a corresponding setting in the Admin area for that but assume it’s the same as the ACF equivalent. The server idle and life timeouts seem to be saved in milliseconds - I have mine set default as 1min life, 10s idle so assume these are okay and working as expected?

@ASKemp It is my understanding that if an email fails to send it gets re-tried at set intervals which are hard-coded into Lucee:

  • 1 minute
  • 5 minutes
  • 1 hour
  • 24 hours

It looks like there is already a ticket open to make these setting configurable - it looks prety old though…

https://luceeserver.atlassian.net/browse/LDEV-698

1 Like

Many thanks for the reply Martin, will take a look at that. I assume this code is not available to change in the installed versions of Lucee - a quick search fails to find references to that.

Looks like I may need to my own task to execute spooler tasks then can supposedly be done from the Admin Tasks page (services.tasks.cfm) - yet doesn’t show for me.

Any ideas how I’d go about writing an execute spooler task bit of code given a directory full of .tsk files? - as said, the Tasks page is not working for me so can’t see what the password/admintype/data.ids[idx] values are that it uses.

Edit: Okay, think I’ve figured it out. The type in this case is “web”, with my admin password and the id is literally the task filename minus the extension. Did a test against one in my code that checks for files in the directory and it went so just need to loop through the rest.

Yep. that works - bit slow though since it’s just running the executeSpoolerTask on one at a time - any way to do more at a time?