This confused me too. Everything on the web will point you to using the Office 365 API, but trust me, that's not what you will want to do. You will want to use the Exchange API. Office 365 just IS an Exchange server so you can automate it in the same way you can automate any Exchange server. There is sample code here. It is very simple.
Consume Office 365 REST API Without UIConsume Office 365 REST API Without UI
The Office 365 API is just a set of tools for buildings UI based apps that allow the user to enter their Office 365 credentials and allow the app to work on their behalf.