Connection issues between servers


So around December 12th, we started getting intermittent issues with sending email via Microsoft’s 365 SMTP servers. Every 5th attempt or so was simply failing to connect. We rectified this by moving to Mailchimps SMTP instead, which has been fine.

Then the other day, we started getting similar intermittent issues with connecting between, or even doing a curl request to the same server. At the time, the error was because we had an IP block on the php page to prevent it being accessed by anyone other than our own system and the failure was because it was coming from an unrecognised IP.

Now, when it fails, we get the following output from the PHP server variables via CURL:

[HTTP_CF_RAY] => 788e8345dc515b44-FRA
[HTTP_CF_VISITOR] => {“scheme”:“https”}

but when it works, we get:

[HTTP_X_FORWARDED_FOR] => 2001:41d0:700:45e7::
[HTTP_CF_RAY] => 788e8d0459f9bbce-FRA
[HTTP_CF_VISITOR] => {“scheme”:“https”}
[HTTP_CF_CONNECTING_IP] => 2001:41d0:700:45e7::

Now if we have Cloudflare proxying turned on, why are we getting our system IP showing as the forwarded one sometimes? This never used to be the case. We’ve always limited the PHP page to show to the IPv6 address only, but every 5th or so attempt, it now reverts to our actual machine IP.

I also can’t figure out why that would prevent Microsoft from allowing us to log on to their SMTP servers, but I guess it’s possible that a reverse DNS or something doesn’t work on that IP so it doesn’t have permission.

This isn’t the case from another one of our servers though, so I guess why would this be happening on only one of our servers? Is this a Cloudflare issue? If it’s a server issue, where do I begin?

Thanks in advance!