I'm using Python in a webapp (CGI for testing, FastCGI for production) that needs to send an occasional email (when a user registers or something else important happens).  Since communicating with an SMTP server takes a long time, I'd like to spawn a thread for the mail function so that the rest of the app can finish up the request without waiting for the email to finish sending.
I tried using thread.start_new(func, (args)), but the Parent return's and exits before the sending is complete, thereby killing the sending process before it does anything useful.  Is there anyway to keep the process alive long enough for the child process to finish?
You might want to use threading.enumerate, if you have multiple workers and want to see which one(s) are still running.  
Other alternatives include using threading.Event---the main thread sets the event to True and starts the worker thread off.  The worker thread unsets the event when if finishes work, and the main check whether the event is set/unset to figure out if it can exit.
Parent Thread exiting before Child Threads [python]