@anthoval it looks like the model you have is a PNP sensor:
017a0361-e34f-47ce-9e35-81aa0d7271e4-image.png
The documentation suggests using a resistive voltage divider to connect a PNP sensor:
https://duet3d.dozuki.com/Wiki/Connecting_a_Z_probe#Section_PNP_output_normally_open_inductive_or_capacitive_sensor
For Duet 3 and 3 Mini: all IOx.in inputs have a 27K pullup resistor to +3.3V, therefore the value of R2 must be low enough to defeat this. We suggest R2 = 2.2K. Then the value of R1 should be 4.7K to 6.8K if the sensor is powered from +12V; or use 10K to 15K if the sensor is powered from +24V.
100mA is far more current than can be sourced/sunk from the IOn.IN pins so that is not the issue.