Python cannot use SMTP...

J

JZ

I cannot find out what is the problem with my Python. I cannot join to smtp
host.
Python 2.3.4 (#1, Jun 22 2004, 04:42:42)
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/smtplib.py", line 242, in __init__
raise SMTPConnectError(code, msg)
smtplib.SMTPConnectError: (-1, "onnect: failed to connect to database:
Error: Access denied for user: 'admin@localhost' (Using password: YES)")

The same problem appears in Plone 2.0.4. I cannot send any emails because
of it and I do not know how to sove it.

I checked PHP scripts on the same linux box, but it works fine. Only Python
has the problem...
 
P

Peter Hansen

JZ said:
I cannot find out what is the problem with my Python. I cannot join to smtp
host.

Python 2.3.4 (#1, Jun 22 2004, 04:42:42)
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/smtplib.py", line 242, in __init__
raise SMTPConnectError(code, msg)
smtplib.SMTPConnectError: (-1, "onnect: failed to connect to database:
Error: Access denied for user: 'admin@localhost' (Using password: YES)")

This appears to be because your server is responding in a non-standard
way. The "-1" arises because an improperly formed SMTP response line
was received.

Try connecting using telnet ("telnet localhost 25") and see what you
get. It should look something like the first line here:

220 some.host.name blah blah blah

The first three characters are the critical part. If they aren't
a three-digit SMTP response code, your server is likely borken.
If you post the results, someone might have some advice, but it's
not likely this is a Python issue.

-Peter
 
J

JZ

Wed, 01 Sep 2004 08:33:51 -0400, na comp.lang.python, Peter Hansen
napisa³(a):
The first three characters are the critical part. If they aren't
a three-digit SMTP response code, your server is likely borken.
If you post the results, someone might have some advice, but it's
not likely this is a Python issue.

via telnet localhost 25:
....
Connected to localhost.
Escape character is '^]'.
db_connect: failed to connect to database: Error: Access denied for user:
'admin@localhost' (Using password: YES)
220 NS1.4U2.PL ESMTP

Strange, because I can send emails from bash using mail command. I can send
email with php scripts as well (using mail() function). php.ini file has
empty settings for SMTP, so it uses default system settings...
 
R

Ronald Oussoren

Wed, 01 Sep 2004 08:33:51 -0400, na comp.lang.python, Peter Hansen
napisa©©(a):
The first three characters are the critical part. If they aren't
a three-digit SMTP response code, your server is likely borken.
If you post the results, someone might have some advice, but it's
not likely this is a Python issue.

via telnet localhost 25:
...
Connected to localhost.
Escape character is '^]'.
db_connect: failed to connect to database: Error: Access denied for
user:
'admin@localhost' (Using password: YES)
220 NS1.4U2.PL ESMTP

This is a buggy mail server, the line starting with 'db_connect' is not
according to spec.

If other tools work that is coincidence.

Ronald
 
P

Peter Hansen

JZ said:
Wed, 01 Sep 2004 08:33:51 -0400, na comp.lang.python, Peter Hansen
napisa³(a):
The first three characters are the critical part. If they aren't
a three-digit SMTP response code, your server is likely borken.
If you post the results, someone might have some advice, but it's
not likely this is a Python issue.

via telnet localhost 25:
...
Connected to localhost.
Escape character is '^]'.
db_connect: failed to connect to database: Error: Access denied for user:
'admin@localhost' (Using password: YES)
220 NS1.4U2.PL ESMTP

Strange, because I can send emails from bash using mail command. I can send
email with php scripts as well (using mail() function). php.ini file has
empty settings for SMTP, so it uses default system settings...

I expect other tools are being more lenient, ignoring each line that
doesn't look like a proper SMTP reply until they find one that does.
That doesn't mean the smtplib approach is wrong, mind you...

It would be pretty easy to hack your local smtplib.py to skip over that
junk, if you were so inclined.

Probably even easier just to fix the server...

-Peter
 
T

Thomas =?ISO-8859-1?Q?Kr=FCger?=

JZ said:
smtplib.SMTPConnectError: (-1, "onnect: failed to connect to database:
Error: Access denied for user: 'admin@localhost' (Using password: YES)")

That a MySQL error. I don't kwon how you made this error apear in your STMP
connection, I can only guess:
Does your STMP server any MySQL authentication?
Are you running MySQL on port 25?

Maybe the right of your mail log and a the result of
"netstat -nlp -A inet"
would help us to find the problem.

Thomas
 
J

JZ

That a MySQL error. I don't kwon how you made this error apear in your STMP
connection, I can only guess:
Does your STMP server any MySQL authentication?

I am not sure. I do not know if it is important but I am using VPS (virtual
computer) hosting. And I did not install sendmail. It was installed as I
got it.
Are you running MySQL on port 25?

No, it works on standard port 3306.
Maybe the right of your mail log and a the result of
"netstat -nlp -A inet"
would help us to find the problem.

Here is the result:

[root@xeon lib]# netstat -nlp -A inet
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
PID/Program name
tcp 0 0 216.93.188.184:20000 0.0.0.0:* LISTEN
5912/perl
tcp 0 0 216.93.188.184:199 0.0.0.0:* LISTEN
4648/snmpd
tcp 0 0 216.93.188.184:3306 0.0.0.0:* LISTEN
20595/mysqld
tcp 0 0 216.93.188.184:10000 0.0.0.0:* LISTEN
6339/perl
tcp 0 0 216.93.188.184:8080 0.0.0.0:* LISTEN
4113/python
tcp 0 0 216.93.188.184:80 0.0.0.0:* LISTEN
20390/httpd
tcp 0 0 216.93.188.184:21 0.0.0.0:* LISTEN
7910/xinetd
tcp 0 0 216.93.188.184:8021 0.0.0.0:* LISTEN
4113/python
tcp 0 0 216.93.188.184:22 0.0.0.0:* LISTEN
17856/sshd
tcp 0 0 216.93.188.184:8280 0.0.0.0:* LISTEN
4113/python
tcp 0 0 216.93.188.184:25 0.0.0.0:* LISTEN
7910/xinetd
udp 0 0 216.93.188.184:10000 0.0.0.0:*
6339/perl
udp 0 0 216.93.188.184:20000 0.0.0.0:*
5912/perl
udp 0 0 216.93.188.184:161 0.0.0.0:*
4648/snmpd
 
T

Thomas =?ISO-8859-1?Q?Kr=FCger?=

JZ said:
tcp 0 0 216.93.188.184:25 0.0.0.0:* LISTEN
7910/xinetd

Port 25 is handled by the xinetd. There may be a wrapper around it.
What program will be started on connetion to port 25?
See the /etc/xinet.d/ folder to find it out.

You may also try to send mail to 216.93.188.184 instead of localhost

Thomas
 
J

JZ

Wed, 01 Sep 2004 17:17:15 +0200, na comp.lang.python, Thomas Krüger
napisa³(a):
See the /etc/xinet.d/ folder to find it out.

It is wrapped with strange soft.
You may also try to send mail to 216.93.188.184 instead of localhost

Without results. I found other solution. I changed smtp to other host and
it helped.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top