Please refer to the following document for manual setup with O365 in conjunction with the Hornetsecurity spam filter and archiving.