How do I send e-mail using Gmail's SMTP and Indy 10?

10,830

Perhaps Marco can help you...

Edit: with this link to the source code.

Share:
10,830
rag
Author by

rag

Just a developer wannabe.

Updated on June 11, 2022

Comments

  • rag
    rag almost 2 years

    I'm using Delphi 2009 and the lastest Indy 10 from svn to send e-mails using SMTP, but it doesn't work with Gmail (Google Apps hosted domain). When I try to send an e-mail I get "Must issue a STARTTLS command first".

    I tried Googling about it and I found several forums and several solutions, but they all just bashed some code or just said I needed an OpenSLL DLL, which so far isn't very clear to me exactly what I need.

    Can someone please tell exactly which DLL I need and what do I have to change in the my TIdSMTP and TIdMessage objects in order to send the e-mails through Gmail's SMTP server?

    Also, an explanation about why this authentication is different and what the DLL is for is very welcome.

  • rag
    rag over 14 years
    That worked, thanks, one thing that I'm still not sure, do I really need the OpenSSL dlls? The article says nothing about it, but when I tested it gives me an exception "Cannot load library" if I try to send e-mails without the dlls. This is still not very clear to me. Thanks.
  • Remy Lebeau
    Remy Lebeau over 14 years
    You need the OpenSSL DLLs if you use Indy's native SSL IOHandler class, There are third-party IOHandler classes available that do not use the DLLs.
  • delphirules
    delphirules over 8 years
    Can you please mention one of these third-party classes @RemyLebeau ?
  • Remy Lebeau
    Remy Lebeau over 8 years
    @delphirules: Eldos SecureBlackbox includes an Indy IOHandler class that uses SBB's own SSL/TLS implementation instead of OpenSSL. Also, in a future release, Indy will likely provide a native IOHandler class for Microsoft's CryptoAPI/SChannel SSL/TLS implementation as an alternative to OpenSSL on Windows.