This will be a very difficult task with Terramaster. I would rather suggest you use a safer NAS than that. Synology will have regular security updates and protection tools. Here is how to set up your own mail server https://www.youtube.com/watch?v=WcNqGzUgj_o
I would recommend any plus series models.
I would recommend any plus series models.