validate the generated email address and fall back to localhost.localdomain in case it is not valid

fixes #1844
Merge pull request #2016 from owncloud/fixing-1844-master

validate the generated email address and fall back to localhost.localdom...