N00B: Which sensor?

or you could use a reed switch (sometimes called a reed relay) which is also triggered by a magnet.