473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

smtplib

Hello people!

I have a little problem here sending an email using python, I have never worked with smtp, not my field at all, I know i need to setup a listener or something on my computer in order to be able to send an email, now i know this code should be able to send the email


import smtplib

s = smtplib.SMTP('localhost')
s.sendmail('falseemail@nothing.com', 'recipient@host.com, 'hi there!')
s.quit()



but i get this error message

AttributeError: 'module' object has no attribute '__path__'


I think it's something to do with the smtp setup on my own machine, could anyone help me please?

Thanks a bunch
Jul 5 '08 #1
3 1506
numberwhun
3,509 Expert Mod 2GB
Any chance you could tell us what OS you are on first?

Regards,

Jeff
Jul 6 '08 #2
oops, Windows XP SP2
Jul 6 '08 #3
Check if your configured mail Server is listening at port 25, that port is associated with the internet operations. if u r not able to configure your mail server to that port check if there in already an SMTP service running at that port.
your code worked fine for me
Expand|Select|Wrap|Line Numbers
  1. >>> import smtplib
  2. >>> s= smtplib.SMTP('localhost')
  3. >>> s.sendmail('xxx@mydomain.com','yyy@gmail.com','smtp Mail')
  4. {}
  5. >>> s.quit()
Jul 7 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Bill | last post by:
I am trying to have the capability to email attachments. Specifically I want to be able to email a specific attachment that I name that may be a PDF document, text doc, etc. I already have a...
1
by: David Hughes | last post by:
I wonder if anyone can help me resolve this problem. Although my ISP (One and One) provides the facility to run Python 2.2 CGI programs, their technical support people don't seem to have any Python...
0
by: Frank Zheng | last post by:
I wrote some code to test "smtplib", but i met a problem when i call the "login(user,pass)" of the "SMTP" object. here are the codes: >>> s = smtplib.SMTP() >>> s.set_debuglevel(1) >>>...
3
by: yazzoo | last post by:
Does anyone know what causes an SMTPLIB DataError? The only thing I can find in the manual is exception SMTPDataError The SMTP server refused to accept the message data. My problem is a...
6
by: stewart.midwinter | last post by:
I'm having problem with a script that used to work under Win2k but is now broken after an install of WinXP Pro. I can no longer connect to a local mail server. Has anyone else seen this? If so,...
0
by: Tim Williams | last post by:
I have a working SMTP client that I need to add TLS capability to, I absolutely need the client to timeout within a specified time, but when I use the sock.timeout() line it freezes the reading...
3
by: Van_Gogh | last post by:
Hi, I am learning how to use the smtplib module, but am having some very early problems, maybe because I don't understand it. So, am I correct that by following the example in the Python: >>>...
0
by: Roger | last post by:
I am having a problem sending email through smtp.gmail.com using smtplib. Everything works and the mail is sent and received, except quit. The following shows the problem (without bothering to...
5
by: zxo102 | last post by:
Hi, I am trying to use python module smtplib to send my email out on window xp (localhost). import smtplib server = smtplib.SMTP('localhost') but I got the error information as follows: ...
1
by: Hunter | last post by:
I am writing a script that needs to send some emails. And I've used smtplib in the past and it is pretty easy. But I thought, gee it would be easier if I could just call it as a function, passing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.