How to execute multi-threaded / background process in classic asp

I need to send email through a background job in a classic-asp application so that the user does not have to wait for a slow web server to send email.

I know that I can use Ajax to generate two separate requests, but I would prefer not to use Javascript. Also, I suspect there is a better way to take this off. Ideas?

+4
source share
7 answers

You think too narrowly. You do not need to send an email from ASP. Put it in the database, and then run a separate program that runs, say, every minute and sends all the emails that are in the database.

+11
source

I agree with tomjen on this. Storing email in a database table and then using the internal process to actually send email works very well, especially if you send large volumes of email. I would recommend Perl for creating an email program, as there are several packages that could easily do the job.

+3
source

There are third-party COM objects , you can receive mail with this descriptor much better than the built-in IIS. You simply send your message and process the queue so that your program immediately regains control.

+2
source

Persits creates the well-known AspEmail COM component, which comes with a message queuing system that will do what you need.

http://www.aspemail.com/manual_07.html

Your code, in fact, disables sending a message to the queue daemon that runs on the server, and sends all the letters to the queue in a separate process, thereby not bringing your ASP script to completion.

+2
source

Sorry, but as far as I know, there were no ways to generate a separate thread using the old ASP.

If you do not want AJAX to hide IFRAME? ugly but it works ...

+1
source

If you do not want to use my other suggestion, you may want to run another program that simply sends email and then communicates with this program through COM or a (local) tcp socket. This should be much faster than connecting to the server over the Internet, and you avoid database latency.

+1
source

A good way to speed up this would be to tell CDOSYS to use your web server's IIS pickup directory (usually c: \ inetpub \ mailroot \ pickup). Assuming you have a virtual SMTP server installed on your web server.

Another similar and even faster option would be to manually generate * .EML files and put them in the pickup directory. In addition, to avoid potential conflicts, you can put the files in a temporary directory, and then move the batch file to the pickup directory at regular intervals.

0
source

Source: https://habr.com/ru/post/1285770/


All Articles