Traceback (most recent call last):
File "tryemail.py", line 24, in ?
server = smtplib.SMTP(SERVER)
File "/usr/lib/python2.4/smtplib.py", line 258, in __init__
addr = socket.gethostbyname(socket.gethostname())
socket.gaierror: (-2, 'Name or service not known')
Googling some more and I found this thread which basically says that python smtplib requires the hostname to be resolvable to send out email. So after some more googling (don't you just love google? :P) I found out how to change the hostname. So basically you need to change the HOSTNAME setting in /etc/sysconfig/network. But that requires a reboot. To avoid reboot just echo the hostname into /proc/sys/kernel/hostname. Finally. Now it's all done.. :)