1

I believe that we are able to send email directly to destination MX server such as ('gmail-smtp-in.l.google.com', 25). However I can't connect to the mail server even with socket programming in Python 3.5.1.

import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
    sock.connect(('gmail-smtp-in.l.google.com', 25))

Code above always gives me the following error at line 3.

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 found that people [1] are able to connect to the server stated above, please help me with this issue as I am still clueless about it after hours of research work carried out.

Note that I am running the code on a local computer.

[1]. How to send a mail directly to SMTP server without authentication?

Community
  • 1
  • 1
SpringMaple
  • 311
  • 3
  • 11
  • It can be a firewall blocking your access. Can you connect manually using `telnet gmail-smtp-in.l.google.com 25`? – Selcuk Apr 19 '16 at 08:43
  • @Selcuk My firewall program is not turned on from the beginning and I don't have any anti-virus program installed as well. For `telnet`, I get connection timed out issue too. I tried to run the code from my home and working office with no luck neither. – SpringMaple Apr 19 '16 at 08:56
  • I can connect just fine using telnet. It is most certainly a network issue on your part. Some ISPs block port 25 to prevent spambots. – Selcuk Apr 19 '16 at 09:03
  • 1
    @Selcuk You narrowed down the problem domain for me to tackle, thank you very much :D I am surprised after viewing your profile, you're such a capable person :D – SpringMaple Apr 19 '16 at 09:08

0 Answers0