hi
having a few problems sending an email with smtplib. i do have an
smtp server running on port 25 of my local machine
here's the relevant code (taken from python docs):
s = smtplib.SMTP('localhost')
s.connect()
s.sendmail(me, to, msg.as_string())
s.close()
and i'm getting this error:
Traceback (most recent call last):
File "pysendmail.py", line 31, in ?
s = smtplib.SMTP()
File "/usr/lib/python2.3/smtplib.py", line 254, in __init__
addr = socket.gethostbyname(socket.gethostname())
socket.gaierror: (-2, 'Name or service not known')
if i don't sepcify 'localhost' i get the same error
if i specify the port and local_hostname too
class SMTP([host[, port[, local_hostname]]])
then my script just freezing at some point trying to connect/send and
the email doesn't get sent
if anyone can help that would be great...
jon 8 4812
What are you getting in your smtpd logs? Are you using postfix?
sendmail? or are you running this against a Windows stmp service?
Harlin Seritt
Internet Villa: www.seritt.org
I also can't get my SMTP (win2k) working with Python.
But... funnily this works fine:
import smtplib
s = smtplib.SMTP('smtp.mail.ru')
s.sendmail('n**************@mail.ru', 'jonhe...@gmail.com', 'hi
there!')
s.quit()
Why do they (mail.ru) allow outsiders to use their service???
n00m wrote: I also can't get my SMTP (win2k) working with Python. But... funnily this works fine:
import smtplib s = smtplib.SMTP('smtp.mail.ru') s.sendmail('n**************@mail.ru', 'jonhe...@gmail.com', 'hi there!') s.quit()
That's pretty strange: the second argument should be a list. Are you
*sure* it worked?
Why do they (mail.ru) allow outsiders to use their service???
Ask them!
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Steve Holden wrote: That's pretty strange: the second argument should be a list. Are you *sure* it worked?
Hmm...
I sent a couple of letters to my two different addresses... and got
them!
I'm running Fedora Core 3, and I assume thats useing sendmail...
On 2 Sep 2005 04:25:41 -0700, Harlin Seritt <ha**********@yahoo.com> wrote: What are you getting in your smtpd logs? Are you using postfix? sendmail? or are you running this against a Windows stmp service? Harlin Seritt Internet Villa: www.seritt.org -- http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote: n00m wrote:
I also can't get my SMTP (win2k) working with Python. But... funnily this works fine:
import smtplib s = smtplib.SMTP('smtp.mail.ru') s.sendmail('n**************@mail.ru', 'jonhe...@gmail.com', 'hi there!') s.quit() That's pretty strange: the second argument should be a list. Are you *sure* it worked?
No longer required (as of at least Python 2.3 if not earlier).
"to_addrs : A list of addresses to send this mail to. A bare string
will be treated as a list with 1 address." (from smtplib.py sendmail()
docstring)
-Peter
Peter Hansen wrote: Steve Holden wrote:
n00m wrote:
I also can't get my SMTP (win2k) working with Python. But... funnily this works fine:
import smtplib s = smtplib.SMTP('smtp.mail.ru') s.sendmail('n**************@mail.ru', 'jonhe...@gmail.com', 'hi there!') s.quit()
That's pretty strange: the second argument should be a list. Are you *sure* it worked?
No longer required (as of at least Python 2.3 if not earlier).
"to_addrs : A list of addresses to send this mail to. A bare string will be treated as a list with 1 address." (from smtplib.py sendmail() docstring)
Oops. Documentation bug. Fortunately it looks like it's been fixed in
response to bug 1217513. Thanks for the tip, Peter.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
just got home and i've tried my script on windows with my isp's smtp
server, and found that my code wasn't getting past the s.connect()
changed me code to:
s = smtplib.SMTP('smtp.lineone.net')
s.sendmail(me, to, msg.as_string())
s.quit()
and now it works fine
On 9/2/05, Steve Holden <st***@holdenweb.com> wrote: Peter Hansen wrote: Steve Holden wrote:
n00m wrote:
I also can't get my SMTP (win2k) working with Python. But... funnily this works fine:
import smtplib s = smtplib.SMTP('smtp.mail.ru') s.sendmail('n**************@mail.ru', 'jonhe...@gmail.com', 'hi there!') s.quit()
That's pretty strange: the second argument should be a list. Are you *sure* it worked?
No longer required (as of at least Python 2.3 if not earlier).
"to_addrs : A list of addresses to send this mail to. A bare string will be treated as a list with 1 address." (from smtplib.py sendmail() docstring) Oops. Documentation bug. Fortunately it looks like it's been fixed in response to bug 1217513. Thanks for the tip, Peter. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: Karl Ehr |
last post by:
I have written the following simple program to monitor a single URL,
and notify me via email whenever this URL changes. Intermittently,
I raise the following exception:
Traceback (most recent...
|
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,...
|
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...
|
by: Chris Withers |
last post by:
Hi All,
The following piece of code is giving me issues:
from email.Charset import Charset,QP
from email.MIMEText import MIMEText
charset = Charset('utf-8')
charset.body_encoding = QP
msg =...
|
by: Slippy |
last post by:
Hi, python newbie, struggling to learn here. I'm trying to write a
simple program which posts messages to my google group (via email).
I'm using smtplib, email and email.message to build and send a...
|
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...
|
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:
...
|
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...
|
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,...
|
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$) {
}
...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |