I like your idea for letting threads talk to each other, but for the specific case of sending an email I think a generic email handler would be better. Maybe start an email handler and use a queue to pass in requests, along w/ the username and sessionID.  This way if an email does not get sent you could have an opportunity to log an message somewhere to that effect.

On the other hand if a user does something in a website that sends email they expect to get the email within a few minutes.  Unless you are sending a huge message you should not need threading if your email server is awake.  What you may need is just something like:

try:
    sendEmail('From','to','Your new password',body)
except:
    response.write ('Sorry - our email server does not like you in partciular, others can send email just not you')

-Aaron

zunzun@zunzun.com wrote:
Could you please post a code snippet so that I can see how you
implemented threading?
    

WebKit did the actual threading once I configured it to
have multiple threads.  After that, I had to make certain
that each thread had it's own data dictionary.

I shamelessly took the idea from ActiveState's web site at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66429

I have functions that return this thread's data dictionary,
or another thread's data dictionary.  Makes it convenient for
the threads to talk to each other.  Make certain to delete
the dictionary for each thread when it sleeps.  My code is:

if not vars().has_key("_tss"):
    _tss = {}
if not vars().has_key("_tss_lock"):
    tss_lock = thread.allocate_lock()


# get's specified thread's data dictionary
def get_tss_id(thread_id):
    """Return a thread-specific storage dictionary."""
    tss = _tss.get(thread_id)
    if tss is None: # First time being called by this thread.
	try: # Entering critical section.
	    tss_lock.acquire()
	    _tss[thread_id] = tss = {} # Create a thread-specific dictionary.
	finally:
	    tss_lock.release()
    return tss

# gives this thread's data dictionary
def get_tss():
    """Return a thread-specific storage dictionary."""
    return get_tss_id(thread.get_ident()) # Identify the calling thread.

# resets a specified thread's data dictionary
def reset_tss(thread_id):
    if _tss.has_key(thread_id):
	del _tss[thread_id]


     James Phillips
     http://zunzun.com



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss
  

-- 
-Aaron
http://www.MetroNY.com/
"I don't know what's wrong with my television set. I was getting
 C-Span and the Home Shopping Network on the same station.
 I actually bought a congressman."
    - Bruce Baum