added flow control, smtp test error handling