'Word Breaker - How can my program return a valid sequence of words?

I am trying to break up the message so it prints as a valid sequence of words with spaces. For instance, the message,'wearthemask' would print either 'wear the mask' or 'wear them ask' (either being acceptable). The program will run through a .txt dictionary file that contains 60,000 english words (one on each line), thus being able to decipher different words in the message.

   message = ['wearthemask']

   def messageRecovery(words, message): #words come from words.txt file and message is the string
   if len(words)==0:
         return True
   for i in range(1,len(message)+1):
         word1 = message[:i]
         if not word1 in words:
             continue
         if messageRecovery(message[i:],words):
             return True 
        else:
             return False

   print(" ".join(message))
   print()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source