🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

TIdSMTP with gmail

#3354
From: Blake Young
Date: Mon, 24 Oct 2005 18:36
25 lines
2172 bytes
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 = "young.blake@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: <435d2919$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,9b5278719412006b,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
Date: Mon, 24 Oct 2005 13:36:56 -0500
Lines: 27
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: <435d2919$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130178841 67.65.21.73 (24 Oct 2005 11:34:01 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail