In this project we use ultrasonic sensor, and if the distance is less than 50cm, sensor will send and e-mail with temperature and humidity
Read up about this project on