I noticed that when receiving emails on my domain they come delayed compared to another domains i have tested.
The emails are being forwarded from a google email to two different addresses most of the time the emails are delivered with no delay but sometimes the delay have been up to 8 minutes.
Due to the nature of my application i need the email once received be sent as an HTTP request to my server, first time i tried using mailgun and i those issues emerged, so then i switched to using: https://github.com/Flolagale/mailin on my own server and then POST to localhost and for my surprise the delays kept happening.
It doesn't happen all the time but it happens a few times a day but some of those emails are time sensitive and can't be delayed.
At some point i started forwarding the emails to another service who does the same i'm doing ( receiving emails and posting the messages to a telegram room ) and their service ALWAYS receive it and post with no delays, funny enough they use mailgun which was my first choice.
I thought it could be due to my application implementation but it doesn't seem to have any load on the machine at all, the linux machine running my http server and mail server has a lot of CPU and RAM headroom.
I suspected it could be the TTL or any other configuration on my MX record but i can't find information regarding this sort of connection between emails being delayed.
What am i possibly doing wrong?