added script to get all subdirectories and fixed email testing