Email from/to Gmail Only

Hi all. I want to run an email server behind the mikrotik router. I want to receive and send emails from/to Gmail only. How can I implement this to mikrotik router? Thank you.

To choose which remote servers / clients to accept, this concerns the mail server configuration, not the RouterBOARD.
To “guess” if you need NAT or just a firewall filter, you have to specify the parameters of the RouterBOARD and the Server.

First of all, clarify what you want and ask a more specific question by providing all the necessary details.

The less details you write, the less help you get.

elmertronics:

Use Firewall DNAT to forward traffic to your MTA.
SNAT to be sure MTA will out the same IP what you use in DNAT.


I want to receive and send emails from/to Gmail only.

on MTA use some whitelist on gmail.com and block others.
You can try filter on Firewall the IP from Gmail servers too.

As @rextended explained this has very little to do with Mikrotik as such (just a few of filters needed for that). To succeed with relaying using smtp on google mail servers you need a public ip, mx-domain and proper setup of spf/dkim/dimarc (arc) which google is very picky about before any email is let through.

Besides the need for a Corporate or Google Workspace account to setup spf for your domain you have to hijack outbound port 25 to always point to smtp-relay.gmail.com and the other way around to allow only inbound smtp from google. There are plenty of help pages from Google regarding this like: https://support.google.com/a/answer/2956491?hl=en