If i copy/paste line for line the below code into IDLE (v2.5 or v2.6) it works perfectly and sends me the email message.
import smtplib fromadd = "firstname.lastname@example.org" toadd = "email@example.com" msg = "Insert message body here" server = smtplib.SMTP('exchange01.foo.com') server.sendmail(fromadd, toadd, msg) server.quit()
However, If I try to open/run the .py script in IDLE (v2.5 or v2.6)(or with os.system(), I get the following error message:
Traceback (most recent call last): File "\\Wc98466\d\baks\dont_use\devel\email.py", line 1, in <module> import smtplib File "C:\Python25\lib\smtplib.py", line 46, in <module> import email.Utils File "\\Wc98466\d\baks\dont_use\devel\email.py", line 12, in <module> server = smtplib.SMTP('exchange01.foo.com') AttributeError: 'module' object has no attribute 'SMTP'
Any ideas as to why these are running differently if I run from a file vs copy/pasting the code directly into IDLE as I am totally at a loss?