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
 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
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
Free Network Mapping Tool for Microsoft® Office Visio® Professional 2007 Users
Don't map your network by hand – let LANsurveyor Express for Microsoft Visio Professional 2007 automatically create network diagrams for you.
subscribe
Free eBook:"Vulnerability Management for Dummies"
Get all the Facts and See How to Implement a Successful Vulnerability Management Program.
subscribe
Google vs The World: The Battle of the Message Security Vendors
With such a powerful name behind it, Google Message Security stands out in a sea of products that do exactly the same thing - or so they say.
subscribe

Safe, Secure Backup


All times are GMT. The time now is 06:41 AM.






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

Content Relevant URLs by vBSEO 3.3.0 RC2