Hello there,
If you guys just setup mail server with aaPanel and your mails are ending up in spam it might not be the fault of aaPanel but some misconfiguration on your end like svf pointing domains and other such things. Let me say one thing first if your IP is in some kind Blacklist your mails will always end up in spam or worst case scenario getting rejected alltogether, i know microsoft do that they will reject mail and they also use inhouse blacklist so beware and always try to get a unabused IP address from your host.
Step one after setting/installing and configuring a mailserver:
Configure SPF records and mx records so your domain can send or recieve mails with your mail server. It's really critical and messing this one up is same as not being able to use mail service at all(atleast for some providers).
Step Two:
Setup SSL and/or TLS for your mail server for encryption.
Step Three:
Setup DMARC and DKIM(if you are using roundcube or any other webbased mail).
Step Four:
Test your mail server by using mail-tester.com or any other mail test service.
If you receive a perfect 10 then it's highly unlikely your mails would ever go in spam ofcourse unless you are sending some dodgy stuff that matches their spam filter rules.
If somehow your mails are still ending up in spam i would suggest you to use SMTP relay instead of system mail() function as it might be related to your IP being blacklisted.
Note: I personally don't use aaPanel mail server as i prefer to use a standalone mailserver so all the resources of that specific server can be utilised only for mails with functionality such as virus scanning with clamAV and spamassasin but nonetheless i also have to setup these records before i am able to send and receive mails on that server. One more thing to notice your mail server should always have a reverse domain setup for your mail server IP for better mail score.