Use only Email Feature

Hi,
I migrated my application from virtualmin to Amazon’s Elastic Beanstalk but I would like to continue to use my virtualmin server for email.
The problem is, that I cannot receive email and can’t even connect to the server. I highly assume that my DNS records are incorrect (as it worked fine till I changed the DNS to point to beanstalk).
Here they are:

domain.tld MX 10 IP-of-virtualmin-server

imap.domain.tld A IP-of-virtualmin-server

mail.domain.tld A IP-of-virtualmin-server

smtp.domain.tld A IP-of-virtualmin-server

domain.tld TXT “v=spf1 mx~all”

Is there something wrong with it? Maybe something missing?

Best regards,
Daniel

MX record should not point to an IP address. It should point to a name. That name would probably be mail.domain.tld.