Imap in O365

Occasional Contributor



We're currently in hybrid mode with O365 and AD connect, I have a question regarding imap with O365.  If we have an application on premise that will need to use imap to send/receive email, I would think we'll need to open those ports to/from O365.  Which direction would imap use both 993 and 587?  Is that only incoming and outgoing from o365 or is that incoming to on-premise?


Thanks all,

3 Replies

It is from the application server to Office 365 that you have to open TCP-993 (for IMAP) and TCP-587 for SMTP. So if you have a firewall blocking these ports today you have to allow it outbound for that application server on-premises.


There will be no inbound traffic initiated from Exchange Online to your application.


If you don't want to open these port to all destinations on Internet you have a list of IP addresses used by Exchange Online here:

Perfect, that is the answer I was looking for.  It would be outbound from on-premise to exchange online for both imap and smtp.  Any documentation that would state this that you know of?  Also if those ip address ranges for o365 would change at all?



@Eddie Sardinha You can find information about ports used here:


Yes, the addresses changes sometimes but not that often. There is an RSS feed on the page it sent earlier that you can use to keep updated. Some firewalls can connect directly to this feed and automatic allow communication to these addresses when they are updated.