Mega Search
23.2 Million


Sign Up

Make a donation  
TIdSMTP  
News Group: embarcadero.public.cppbuilder.internet.socket

Hi,

I started on Turbo C and Turbo Vision.   I've been using C++ Builder version 5 dated 1999 for a long time.   I have Borland C++ Builder / Rad Studio XE5.  I'm trying to learn how to use the TIdSMTP  component.  Particularly with Authentication.  Are there any examples ?    I read/ searched the Indy Knowlege Base and website.  All I could find was old stuff from 2004.  Does anybody know where I can download a recent Borland C++ example that works with XE5 that shows a form and how to use the TIdSMTP  compo
nent ?

Also, I have never posted here before so if this is not the right place to ask for help then please point me in the right direction.  Thanks for any suggestions.

Dan 
St. Louis Missouri.  
Borland Customer since 1988

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 9-Nov-2014, at 2:04 PM EST
From: Dan Ambrose
 
Re: TIdSMTP  
News Group: embarcadero.public.cppbuilder.internet.socket
Dan wrote:

> The Indy website look like a ghost town.   Does anybody actually monitor 
it ?
> If I posted a message would somebody reply ?  Where is the best place to
> post a message to the Indy folks ?

The IndyProject website is a bit dated (minus the ChangeLog blog, which I 
post to periodically, and the Install instructions, which I update periodically), 
and the Demos mailing group on Yahoo is fairly dead, but the AToZed forum 
is alive, I monitor it every day and do reply to messages on it.

> Now I need to figure out error exception handling.  I don't know anything 
about
> the exception handling. I've been using a really old 1999 version (V5.0) 
of the
> compiler until now.

v5 of C++Builder?  Or the old command-line C++ compiler?  Either way, exception 
handling works the same in both, as it is a standard feature of C++ itself 
(though the use of the Sysutils::Exception class is specific to C++Builder, 
standard C++ uses the STL std::exception class instead).  Any decent C++ 
tutorial should be able to explain exception handling to you.

> Here is what I have so far.

What you have is fine.  The only suggestion I would offer is to catch an 
Exception object by 'const' reference instead:

{code}
catch (const Exception &e)
{code}

And if you are not going to actually access the Exception object, such as 
to read its Message property, then you can omit the variable name:

{code}
catch (const Exception &)
{code}

These changes offer some optimizations for the compiler to make in the generated 
code.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 11-Nov-2014, at 2:27 PM EST
From: Remy Lebeau (TeamB)
 
Re: TIdSMTP  
News Group: embarcadero.public.cppbuilder.internet.socket
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Dan wrote:
> 
> > I'm trying to learn how to use the TIdSMTP component.  Particularly with
> > Authentication.  Are there any examples?
> 
> You should have a look at my recent comments in the following discussion 
> on the Delphi WinSock forum:
> 
> Delphi XE2 - Indy 10 - SMTP server problem
> https://forums.embarcadero.com/thread.jspa?threadID=109582
> 
> Although geared towards Delphi, everything I said in that discussion applies 
> to C++Builder as well.
> 
> > Does anybody know where I can download a recent Borland C++ example
> 
> There aren't any *recent* demos, unfortunately.  You can look at the older 
> demos on Indy's website (http://www.indyproject.org/Sockets/Demos/) or on 
> the Indy-Demos yahoo group (https://groups.yahoo.com/neo/groups/Indy-Demos), 
> that is about all that is available aside from various newsgroup/forum posts 
> and blog articles floating around.
> 
> > Also, I have never posted here before so if this is not the right
> > place to ask for help then please point me in the right direction.
> 
> Yes, this is the right place.  There are also an Indy-specific forum available 
> on AToZed's server (http://forums2.atozed.com):
> 
> --
> Remy Lebeau (TeamB)


Hey Remy, thanks for the reply.  The Indy website look like a ghost town.   Does anybody actually monitor it ?  If I posted a message would somebody reply ?  Where is the best place to post a message to the Indy folks ?

Moving on ... I figured out how to make it work in C++ Builder/Rad Studio XE5.  Now I need to figure out error exception handling.  I don't know anything about the exception handling. I've been using a really old 1999 version (V5.0) of the compiler until now.  Where / how can I learn about exception handling ?    Here is what I have so far.  


IdMessage1->Clear();
IdMessage1->From->Address = "PaulRevere@patriots.com";
IMessage1->From->Name = "David I";
IdMessage1->Subject = "XE5";
IdMessage1->Recipients->EMailAddresses = "georgewashington@usgov.net"
IdMessage1->Body->Add("One is by land, two is by sea");
IdSMTP1->AuthType = satDefault;
IdSMTP1->Host = "smtp.charter.net";
IdSMTP1->Port = 25;
IdSMTP1->Username = "PaulRevere";
IdSMTP1->Password = "BorlandRocks";
IdSMTP1->IOHandler = IdSSLIOHandlerSocketOpenSSL1;
TIdUseTLS tls = getTLSFromInt(iniCfg.smtpTLS);
IdSMTP1->UseTLS = tls;

int isConnected = 0;

try
{

  IdSMTP1->Connect();
  isConnected++;

      try
      {
      	IdSMTP1->Send(IdMessage1);
      }
      __finally
       {
        IdSMTP1->Disconnect();
        }
   }
   catch (Exception &e)
   {
			rc = SMTERR_NO_CONNECTION;
   }

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 11-Nov-2014, at 12:21 PM EST
From: Dan Ambrose
 
Re: TIdSMTP  
News Group: embarcadero.public.cppbuilder.internet.socket
Dan wrote:

> I'm trying to learn how to use the TIdSMTP component.  Particularly with
> Authentication.  Are there any examples?

You should have a look at my recent comments in the following discussion 
on the Delphi WinSock forum:

Delphi XE2 - Indy 10 - SMTP server problem
https://forums.embarcadero.com/thread.jspa?threadID=109582

Although geared towards Delphi, everything I said in that discussion applies 
to C++Builder as well.

> Does anybody know where I can download a recent Borland C++ example

There aren't any *recent* demos, unfortunately.  You can look at the older 
demos on Indy's website (http://www.indyproject.org/Sockets/Demos/) or on 
the Indy-Demos yahoo group (https://groups.yahoo.com/neo/groups/Indy-Demos), 
that is about all that is available aside from various newsgroup/forum posts 
and blog articles floating around.

> Also, I have never posted here before so if this is not the right
> place to ask for help then please point me in the right direction.

Yes, this is the right place.  There are also an Indy-specific forum available 
on AToZed's server (http://forums2.atozed.com):

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 10-Nov-2014, at 10:44 AM EST
From: Remy Lebeau (TeamB)