If this will be used to tell a user Message(‘Email entry is invalid’) I would split checking into parts so messages make it obvious where the problem is so you don’t create puzzle for the user nor tech support.
Tell them they have a space at position X. You could just quietly take out spaces but I wouldn’t.
Check for a single @
Check for invalid periods
Validate before the @
Validate after the @