Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am writing an SMTP client in node.js. I successfully tested it against an SMTP server running on my localhost. However I found out that I am unable to connect to gmail's servers. Trying it with telnet, I run into the same problem.

telnet gmail-smtp-in.l.google.com 587

hangs, and never responds. I do get a response on smtp.gmail.com, but that does not appear to be what I want. What am I doing wrong, and how can I implement it properly.

--Update--

To make it clear, I am sending an email to a gmail account, from my own smtp server

share|improve this question
    
What do you mean by "hangs"? Is telnet failing to connect? –  Shane Madden Apr 11 '12 at 19:24
    
No data is transferred, and after a while the connection closes –  Zwade Apr 11 '12 at 19:57
add comment

2 Answers

up vote 0 down vote accepted

If you're not getting any response whatsoever it is likely to be your ISP blocking outbound port 25 connections. This is fairly common and is a technique for stopping botnet spam on consumer networks. See the MAAWG document on Managing Port 25.

Send from a real host - an Amazon EC2 server will work.

Also for sending mail inbound to Gmail, you want port 25, not 587.

share|improve this answer
    
Thank you. Do you know any way to get around this without deploying it to a server? It would be much easier for testing purposes –  Zwade Apr 11 '12 at 21:08
add comment

Gmails SMTP servers require TLS on port 587 or SSL on port 465. You will have to authenticate.

I suggest you take a look at the official gmail documentation, and some code examples of how others have implemented sending mail via SMTP/Gmail using Node.

share|improve this answer
    
I am not trying to send an email using gmail's smtp servers, but rather send an email to a gmail address –  Zwade Apr 11 '12 at 19:59
    
@Zwade Then you should be using port 25, and connecting to the servers listed in the MX DNS entry of gmail.com instead of hardcoding the primary in your application. –  Shane Madden Apr 11 '12 at 20:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.