🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3357

TIdSMTP with Gmail (repost)

#3357
From: Blake Young
Date: Mon, 24 Oct 2005 20:19
29 lines
2510 bytes
This is being reposted because I accidentally included my email address in 
the previous post.
*******************************************

I am having some difficulty getting SMTP to work with Gmail.  I know that 
this can be done, because I used to have my Outlook client configured to 
send and receive Gmail (via STMP and POP3), and the server/port/options to 
make such a connection are listed on the Gmail help pages.  However, I 
cannot get the connection to work in my program.  Prior to this my program 
worked fine because I used another SMTP server, but it has since been 
disconnected so I need to use Gmail.  Here is the code:

SMTPClient->AuthenticationType = atLogin;
SMTPClient->Host = "smtp.gmail.com";
SMTPClient->Password = <PASSWORD>
SMTPClient->Port = 465;
SMTPClient->UserId = "<USERNAME>@gmail.com";
SMTPClient->Connect();
SMTPClient->Send(EmailMessage);
SMTPClient->Disconnect();

The problem is that the program just hangs on the Connect() line 
indefinitely.  While hanging, however, I ran netstat and saw that a 
connection to the smtp.gmail.com server was made.  I tried adding the Send() 
command to the OnConnected event handler, and this handler method WAS 
executed, but then the program hung AGAIN on the Send() command.  When I was 
using my previous SMTP server, I did not need the OnConnected handler.  The 
Connect() method would return after a connection was made, and everything 
would follow sequentially.
Technical Details
Message-ID: <435d412b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fr.ip.ndsoftware.net!zen.net.uk!dedekind.zen.co.uk!news-out.usenet.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,c03918712292b54e,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Blake Young" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: TIdSMTP with Gmail (repost)
Date: Mon, 24 Oct 2005 15:19:41 -0500
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 67.65.21.73
Message-ID: <435d412b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130185003 67.65.21.73 (24 Oct 2005 13:16:43 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fr.ip.ndsoftware.net!zen.net.uk!dedekind.zen.co.uk!news-out.usenet.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail