Identifying strange components

I'm hacking a gate automation circuit and came across these strange grey boxes with "M" on them. What are they?

My first thought would be large capacitors, but the circuit board has strange connections bellow them as you can see in the photo which is lit from behind. None of these connections beeps under diode test with each other or the obvious terminals from the grey boxes.

This picture is zoom on a case where there are 4 strange exposed pads, a pair each is under one of the 2 smaller grey boxes. One of the pads from one grey component has a trace to a bland wire that goes back to a trace into other strange pad, for seemingly no reason. Obviously, these two pads beep with diode test, but they're the only ones.
Same perspective as before, but front-lit and less zoomed:

These components have writing on them but it's at inconvenient positions. Here's the only acessible writing:

Looks like a film capacitor - the fact that they're marked with a uF value confirms that.

Hi,

MKT X2 capacitors 0.047uf/275VAC 15mm safety film

Tom... :slight_smile:

The "X2" style capacitors are designed for noise supression circuits that connect directly across the AC power line, so they have special features and ratings to make sure that they don't explode or catch fire under expected sorts of overloads (spikes caused by nearby lightning, for example, I guess.)
There's a pretty good explanation here: https://www.hunker.com/13408990/differences-in-x1-x2-y1-and-y2-capacitors