I am trying to connect to gmails's smtp server and send email. But unfortunately, I am getting the below error:
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I have check the script in my local computer and it works. But it doesn't work on VPS. Using the below code to connect to server:
import smtplib, ssl
context = ssl.create_default_context()
with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as smtp_server:
smtp_server.login(username, password)
Related
I'm creating a python script with request. When I try to connect to the API, I'm using
response = session.get('https://localhost/api/client', verify=False)
print(response)
When I run the script, I end with
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine. Can someone please explain me this error???
I thought I'd share this puzzler. . . I've been successfully using 'plain' paramiko for SFTP for years (but always to port 22). I had a requirement to do SFTP over a non-standard port (115) and I could not establish a connection.
Moving to pysftp solved the problem, but as best I can tell, pysftp is built ontop of the paramiko libraries.
'plain' paramiko code:
import paramiko
transport = paramiko.Transport((hostname,115))
transport.connect(username=user,password=passwd)
sftp = paramiko.SFTPClient.from_transport(transport)
The error thrown:
File "c:\python27\lib\site-packages\paramiko\transport.py", line 311, in __init__
'Unable to connect to %s: %s' % (hostname, reason))
paramiko.ssh_exception.SSHException: Unable to connect to XXX.XXX.XXX.XXX: [Errno 10060]
A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because connected host
has failed to respond
Moving to pysftp has solved the problem, but pysftp has a paramiko dependency
sftp = pysftp.Connection(hostname,username=user,password=passwd,port=115)
Insights are appreciated
I have HOST='xx.xxx.xx.xx' and PORT = xxxx
I tried
tn = telnetlib.Telnet(HOST, port=PORT, timeout=5)
I'm getting this error
ConnectionRefusedError: [Errno 61] Connection refused
Is there any other way to telnet to port other than default one?
ConnectionRefused means that the Server refused your connection, which in-turn could mean that telnet service is not running on that port. You can do telnet to any port only as long as the telnet service in running on that port in the server.
I set up a Mosquitto server a few days ago using https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-debian-8.
Playing around with it, everything seemd to be working like I wanted. I am able to connect an android client and MQTTSpy to my own server.
Yesterday I had the great idea of looking for a Kodi plugin that would push status and info to MQTT: https://github.com/owagner/kodi2mqtt
It is able to find the server as I see changes in the Mosquitto log file, however I keep getting the same error:
1492549927: New connection from 81.240.134.64 on port 8883.
1492549927: OpenSSL Error: error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol
1492549927: Socket error on client <unknown>, disconnecting.
1492549932: New connection from 81.240.134.64 on port 8883.
1492549933: OpenSSL Error: error:140780E5:SSL routines:SSL23_READ:ssl handshake failure
1492549933: Socket error on client <unknown>, disconnecting.
1492549934: New connection from 81.240.134.64 on port 8883.
1492549934: OpenSSL Error: error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol
1492549934: Socket error on client <unknown>, disconnecting.
1492549939: New connection from 81.240.134.64 on port 8883.
1492549939: OpenSSL Error: error:140780E5:SSL routines:SSL23_READ:ssl handshake failure
1492549939: Socket error on client <unknown>, disconnecting.
From what I understand there are some issues with certificates but I am not 100% sure what is missing. In the other applications I do not need to provide my own certificates, so I don't see what is missing. I tried using the generated certificates in the Kodi addon, however they seem not to work and I get a different error:
1492541859: New connection from 81.240.134.64 on port 8883.
1492541860: OpenSSL Error: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca
1492541860: OpenSSL Error: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure
1492541860: Socket error on client <unknown>, disconnecting.
1492541862: New connection from 81.240.134.64 on port 8883.
1492541862: OpenSSL Error: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca
1492541862: OpenSSL Error: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure
1492541862: Socket error on client <unknown>, disconnecting.
I'm not sure in what direction I should check. Is something wrong with my server/certificates (seems unlikely since other clients are working) or is something wrong with the python code of the Kodi addon? If so, could anyone shed some light on what is missing (I know my way around coding, just not really around certificate things).
Thanks for the help!
Joren C.
Your python client will need access to the trusted certificate authority. Copy the signed public certificate The browser clients don't need that because they already come loaded with trusted certificate authorities.
If the kodi addon is using the paho mqtt client library , then the following should fix it..
client.tls_set('$your server's public cert$.crt')
Try ssl connection:
openssl s_client -connect 81.240.134.xxx:8883 -CAfile /etc/certs/file.crt -debug
I install the sentry on my server with the Document,one-step,one-step,use my own postgresql,I just change the Database config
Finally,I invite myself by sent email,get this problem
Two possibilities
one:have some error in your config file,for instance your email password or smtp server and so on
two: you don't install smtp software,like postfix,sendmail and so on,and smtp is localhost in your config file