Arduino Mega cannot keep 4 channel 5V Relay Powered

MarkDerbyshire:
... and use the Arduino output pin to switch an N type transistor or a logic N type MOSFET to control the relay

The relays already have an optoisolator installed, limited to 5mA, but it is bypassed byt he Vcc-JDVCC jumper. If the jumper is removed then there is a separate driver availble, but the relays will need power, that cannot be drawn from the arduino.

OP. For a short term test, pull the Vcc-JDVcc jumper and connect JDVcc directly to the Arduino +5V. This will at least remove the excessive load from the output pin.