问题
I have a web app that handles work requests. It emails the users involved on new, changed, and completed requests. The problem is, when it sends the email it takes a while for the page to load. Without the email process, it works fine. I'm using CDO to send messages now directly from the code-behind. Is there a better way that won't tie up the webpage?
I've considered possibly running an exe independently after a request is changed. Is there a way to shell a script that will handle the email, but continue forwad with the webpage load so the shelled script runs independently from the code-behind of the page?
回答1:
You might consider queuing the emails in a database table or a text file that is read by a dedicated service.
Writing the email to the database or text file will be quick, and the service only needs to check for changes every few minutes.
Problem would be you can't notify the user that the email didn't send, though you would have the same problem trying to shell execute another program.
来源:https://stackoverflow.com/questions/13180991/email-from-web-without-tying-up-webpage