In July 1965, Mariner 4 passed within 6,118 miles of Mars, snapping 22 photographs of the planet and taking scientific measurements. 

Source: Wikipedia