You are not logged in.
Pages: 1
Hi everone!
I've been working on a e-mail sending project via SMTP. Here are my codes:
#!/usr/bin/env python
import smtplib
#server = "your.mailhost.net"
fromaddr = "tutkudalmaz@gmail.com"
toaddr = "mektup@tutkudalmaz.org"
subj = "Subject: Hello from python smtplib\n"
xhead = "X-why-python: It's easy to read.\n" # add headers
body = "Python is easy to learn, powerful, glue scripting language that is readable, maintainable, and has great hooks into Java."
# collect headers & body into a string
msg = xhead + subj + "\n" + body
# 3 steps: create smtp object, sendmail, quit.
server = smtplib.SMTP ('smtp.gmail.com',587)
server.set_debuglevel(1)
server.ehlo()
server.starttls()
server.ehlo()
server.login("tutkudalmaz@gmail.com",xxxxxx)
server.sendmail (fromaddr, toaddr, msg)
server.rset()
server.quit ()
When i try to run my sender.py file via Python 2.5 it returns me en error. Here is the error:
Traceback (most recent call last):
File "/home/titus/workshop/sender.py", line 4, in <module>
import smtplib
File "/usr/lib/python2.5/smtplib.py", line 49, in <module>
from email.base64MIME import encode as encode_base64
File "/usr/lib/python2.5/email/__init__.py", line 79, in __getattr__
__import__(self.__name__)
ImportError: No module named base64mIme
But when i try to run sender.py file via Python2.4, it runs successfully. Now i'm so confused?? What's wrong with Python 2.5?
Could you help me please?
In a world without walls,who need windows?
Offline
Pages: 1