Re: Accessing Gmail with Delphi
- From: Mike <nomail@xxxxxxxx>
- Date: Sun, 24 Jul 2005 21:27:47 +0100
On Mon, 25 Jul 2005 07:46:32 +1200, Nicholas Sherlock
<n_sherlock@xxxxxxxxxxx> wrote:
>Mike wrote:
>> But when I compile the example given it can't find
>> "IdExplicitTLSClientServerBase.dcu"
>
>This looks like an Indy unit. Do you have Indy installed?
Yes. I managed to find the following code in the google cache
(delphi3000 site not available).
I've tested it and it works!
All I need to do now is work out how to *send* an email via gmail.
----------------------------------------
delphi delphi3000 article borland vcl code-snippet gmail indy pop3 ssl
Times Scored:
9 Visits:
624
Uploader: Radikal Q3
Company: Q3 Reference: q3.nu/trucomania
Question/Problem/Abstract:
Access GMail accounts vía POP3 SSL
Answer:
GMail is the free mail service of Google.
Recently, the GMail accounts can also be accessed by means of POP3 and
SMTP protocols (that is to say, to use them through a mail client
program like OutLook)
It has a peculiarity, the access to GMail through POP3 uses
encriptación SSL and No-Standard ports.
This tip explains briefly how to connect with POP3 service of GMail
through the Indy components.
You need to put in one form these components:
A TidPop3 (idPop31) (Indy Clients Tab)
A TidMessage (idMessage1) (Indy Misc Tab)
A TIdSSLIOHandlerSocket (IdSSLIOHandlerSocket1) (Indy I/O handlers
Tab)
A TMemo (Memo1)
A TButton (Button1)
So that the SSL works, the Indy uses the OpenSSL library, that is GPL
and that another people do, for that reason, you have to download it
so that the TIdSSLIOHandlerSocket can use it.
I for this test, have downloaded it of:
http://indy.fulgan.com/SSL/and the file that I have used is
indy_openssl096.zip
Descompress the the ZIP and put the two DLLs in the directory of your
project.
Now, make that idPop31 uses the IdSSLIOHandlerSocket1 putting it in
its IOHandler property.
Set the name of the pop server in the Host property of idPop31, that
in the case of Gmail is pop.gmail.com, set the port, that in this case
is special and is 995 and set the username and your password in the
idPop31 component.
Once made, to test the invention, put this code in the OnCLick de
Button1:
procedure TForm1.Button1Click(Sender: TObject);
var
n,
nummsgs : integer;
begin
Memo1.Lines.Clear;
//Conectamos!
idpop31.Connect(0);
//Obtenemos el numero de emails que tenemos
NumMsgs:=idpop31.CheckMessages;
Memo1.lines.add( 'Emails:' +IntToStr(NumMsgs) );
for n:=1 to NumMsgs do begin
idpop31.RetrieveHeader(n,idMessage1);
Memo1.Lines.Add( 'Email Nº:'+IntToStr(n)+
' De:'+idMessage1.From.Text+
' Tema:'+idMessage1.Subject );
idMessage1.Clear;
end;
idpop31.Disconnect;
end;
and you will have an example that will obtain the headers of the
emails of GMail account.
NOTE: Yo need an actual version of the Indy library. If your Delphi
hasn't, dont worry, you can download it from the oficcial website:
http://www.indyproject.org/
--------------------------------------
.
- Follow-Ups:
- Re: Accessing Gmail with Delphi
- From: Maarten Wiltink
- Re: Accessing Gmail with Delphi
- References:
- Accessing Gmail with Delphi
- From: Mike
- Re: Accessing Gmail with Delphi
- From: Nicholas Sherlock
- Accessing Gmail with Delphi
- Prev by Date: Re: Accessing Gmail with Delphi
- Next by Date: Re: OpenPictureDialog Problems
- Previous by thread: Re: Accessing Gmail with Delphi
- Next by thread: Re: Accessing Gmail with Delphi
- Index(es):