Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Programming & Scripting > Python and smtplib module error

Forgot Password?
 Linux Programming & Scripting   C, Perl, PHP, Bash Scripts, anything programming or script related post in here!

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Closed Thread
 
Thread Tools Display Modes
Old 12-13-2007   #1 (permalink)
Linux Newbie
 
Tutku's Avatar
 
Join Date: Jul 2007
Location: Izmir / Turkey
Posts: 168
Send a message via ICQ to Tutku
Python and smtplib module error

Hi everone!

I've been working on a e-mail sending project via SMTP. Here are my codes:

Code:
#!/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:

Quote:
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?

My distro is ArchLinux and 2.6.23 kernel.
Could you help me please?
Tutku is offline  


Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 04:03 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2