Delphi 2007 Handbook








November 8, 2006

My Tips: Indy and GMail

A practical Delphi tip: how to send email to/from GMail using Indy.

In the last year, I've moved a lot of my mail to GMail, although I still run my mail server in the Office. Now, beside my marco.cantu GMail account, I've started to move entire mail domains to GMail, using Google hosted services (very interesting, imho). The trouble is, however, that I have many client programs and web site applications that send mail, so if I want to get rid of my mail server I need to be able to send mail to GMail.

This was not terribly difficult, half-an-hour of research and coding, but not trivial either, as GMail requires you to use SSL for sending email. As Indy has full support for this technology (including TLS, which is what GMail prefers to use), it was only a matter of setting the proper parameters. I found many newsgroup posts, but none had the complete "ready-to-use" code. So I published it in a tip on my web site: Send mail to GMail using Indy.

I don't know if I'll be able to resume publishing coding tips like this on a regular basis, but in any case I've opened a new section on my web site (hosting technical tips with code in a blog is something I don't particularly like). We'll see if/how this evolves.





 

9 Comments

My Tips: Indy and GMail 

SSH or SSL? 
Comment by Anonymous on November 8, 12:57

My Tips: Indy and GMail 

Hi Marco.

If I was you, I'd make my own mailserver act as a
proxy for GMail, that whay you don't need to change
your code while still taking full advantage of GMail.

Cheers,

Andrew
Comment by Andrea Raimondi on November 8, 16:07

My Tips: Indy and GMail 

Deinitely SSL.

SSH is the Secure SHell implementation, it can use 
encryption technologies from SSL.

Gmail (and many others) use POP3 over SSL using port 
995 to fetch mail, and SMTP over SSL using port 465 
to send mail.
Comment by Jeroen Pluimers [http://www.pluimers.com] on November 11, 11:13

SSL/SSH 

Fixed. Thanks.
Comment by Marco Cantù [http://www.marcocantu.com] on November 11, 14:16

My Tips: Indy and GMail 

 Hi Marco,
maybe you'd have to remind not to forget having 
installed SSL dll's for Indy.
I thus advise readers go to 
http://www.indyproject.org/Sockets/SSL.en.aspx, then 
download +install the lacking dll's.
Chears
Comment by didier cabalé [http://didier.cabale.free.fr/delphi.htm] on December 15, 13:07

My Tips: Indy and GMail 

Hi Marco, 
Thank you very much for this example.
It is great.This was what I needed.
Comment by konstantin lalkovski on January 10, 14:51

My Tips: Indy and GMail 

 Hi marco:
   
   I did the same thing just as you mentioned. But 

when I executed my program, an error 

occured:'Credentials Rejected 7sm8437100nz0', I don't

know why? Can you help me solve this problem, I am 

very appreciate of you!! I am Chinese ,and my English

is poor ,so I hope you can understand what I said.

My EMailAddress is : flying_zyz@163.com.
Comment by Yingzhuo Zhang on February 6, 13:29

My Tips: Indy and GMail 

 i have the same prob i cant send an email with the
example u provide any help would be appreciate ;)
Comment by Moussa on February 26, 14:06

My Tips Indy and GMail 

You guys need to go into gmail, and click on the 
settings options. Then go to the forwarding and pop3 
table, and enable pop3 forwarding on your gmail 
accounts.

The ability to remotely access your mail via pop3 is 
not enabled by default, and this will cause a 
connection refusal message like the one you two are 
experiencing..
Comment by Foster on March 18, 02:51


Post Your Comment

Click here for posting your feedback to this blog.

There are currently 0 pending (unapproved) messages.