Recently I had to use an Office 365 mail account with Mozilla Thunderbird. For some reason, Office365 domains are not recognised by default by Thunderbird and such the automatic configuration doesn't work. This took quite a while to debug, as Thunderbird has no built in options for connecting to Exchange servers, hence you have to set up IMAP and SMTP.

Below is my working configuration at the time of writing. It may change with updates of Office 365, but I hope this helps if you're having problems!

Step 1 - New Account

File->New->Existing mail account

Your Name: <The name you wish emails to be sent from>
Email address: [email protected]
Password: xxxxxxxx

Step 2 - Manual Setup

Click Continue followed by Manual Config and enter the server settings below:

Incoming Mail:
Type: IMAP
Port: 993
Username: [email protected]
Security: SSL/TLS
Authentication method: Normal password

Outgoing Mail:
Type: SMTP
Port: 587
Username: [email protected]
Security: STARTTLS
Authentication method: Normal password

Step 3 - Finish setup

Click Re-test followed by Done