From Python 2.6 you can set a timeout in SMTP library (official documentation):
class smtplib.SMTP([host[, port[, local_hostname[, timeout]]]])
"if not specified, the global default timeout setting will be used"
If you use an older version of Python (< 2.6 ) you need to set a socket default timeout:
import socket
socket.setdefaulttimeout(120)
For me worked fine.