Summary: Keep the software on your computer up to date and never share your passwords with anyone!
Different email providers have different security measures. Take a couple minutes to configure your account recovery options including security questions & answers, alternate email addresses, and mobile phone numbers that are allowed to receive password reset requests. A little time now can help save you a lot of frustration and could even protect you from permanently losing access to your email account.
If you have already been hacked here is some information about recovering your email accounts :