🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
9 messages
9 total messages Started by Bud Manz Tue, 26 Jul 2005 18:10
Authenticate problem
#3711
Author: Bud Manz
Date: Tue, 26 Jul 2005 18:10
25 lines
1768 bytes
Hi,

I am trying to use the TIdSMTP control's Validate() function.  Can someone point me in the right direction?  When I use it in a try block, I can't seem to catch the error, the program blows up on me instead.  The affected code follows...

IdSMTP1->Connect(); 
fromAddress = InputBox("Sender Info", "Please insert your email info:", "Alvin Manz <amanz@northweststate.edu>");
userID = InputBox("User ID", "Please enter your email user id:\n\t(the portion before the @ sign)", "amanz");
userPword = InputBox("Password", "Please enter your email password:", "");
IdSMTP1->UserId = userID;
IdSMTP1->Password = userPword;

try
        {
        IdSMTP1->Authenticate();
        } // it blows up here with a '501 Authentication failed'
          // exception error message
catch(...)
        {
        ShowMessage("Authentication failed!\nTry again...");
        exit(0);
        }

Any help is appreciated.
Bud
Re: Authenticate problem
#3712
Author: Remy Lebeau (TeamB)
Date: Tue, 26 Jul 2005 18:55
42 lines
2263 bytes
"Bud Manz" <amanz@northweststate.edu> wrote in message
news:42e67c8d$1@newsgroups.borland.com...

> I am trying to use the TIdSMTP control's Validate() function.
> Can someone point me in the right direction?

What exactly do you need help with about it?

> When I use it in a try block, I can't seem to catch the error,
> the program blows up on me instead.

Please elaborate.

> IdSMTP1->Connect();
> fromAddress = InputBox("Sender Info", "Please insert your email info:",
"Alvin Manz <amanz@northweststate.edu>");
> userID = InputBox("User ID", "Please enter your email user id:\n\t(the
portion before the @ sign)", "amanz");
> userPword = InputBox("Password", "Please enter your email password:", "");
> IdSMTP1->UserId = userID;
> IdSMTP1->Password = userPword;

I would suggest prompting the user BEFORE you connect to the server.

> catch(...)

Depending on your actual version of BCB, '...' may or may not handle VCL
exceptions very well.  You should always catch VCL exceptions explicitally,
ie:

    catch(const Exception &e)

>         exit(0);

NEVER NEVER NEVER NEVER NEVER call exit() in a VCL project!!!!!  It does not
allow the VCL to clean up after itself.  If you want the application to shut
down, use Application->Terminate() instead, which posts a WM_QUIT message to
the main message queue.


Gambit
Re: Authenticate problem
#3713
Author: Bud Manz
Date: Tue, 26 Jul 2005 22:54
58 lines
2765 bytes
Hi Gambit,

I am using BCB6.  Maybe it is just that I {embarrassed grin} am
attempting to use a try, catch for the first time...

If my understanding is correct, the try block will "try" a
block of instruction(s) and return an error code to the catch
block upon completion.  Then, depending on the code, the
program can act appropriately.  Is this correct?

Bud

"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"Bud Manz" <amanz@northweststate.edu> wrote in message
>news:42e67c8d$1@newsgroups.borland.com...
>
>> I am trying to use the TIdSMTP control's Validate() function.
>> Can someone point me in the right direction?
>
>What exactly do you need help with about it?
>
>> When I use it in a try block, I can't seem to catch the error,
>> the program blows up on me instead.
>
>Please elaborate.
>
>> IdSMTP1->Connect();
>> fromAddress = InputBox("Sender Info", "Please insert your email info:",
>"Alvin Manz <amanz@northweststate.edu>");
>> userID = InputBox("User ID", "Please enter your email user id:\n\t(the
>portion before the @ sign)", "amanz");
>> userPword = InputBox("Password", "Please enter your email password:", "");
>> IdSMTP1->UserId = userID;
>> IdSMTP1->Password = userPword;
>
>I would suggest prompting the user BEFORE you connect to the server.
>
>> catch(...)
>
>Depending on your actual version of BCB, '...' may or may not handle VCL
>exceptions very well.  You should always catch VCL exceptions explicitally,
>ie:
>
>    catch(const Exception &e)
>
>>         exit(0);
>
>NEVER NEVER NEVER NEVER NEVER call exit() in a VCL project!!!!!  It does not
>allow the VCL to clean up after itself.  If you want the application to shut
>down, use Application->Terminate() instead, which posts a WM_QUIT message to
>the main message queue.
>
>
>Gambit
>
>
Re: Authenticate problem
#3714
Author: Remy Lebeau (TeamB)
Date: Wed, 27 Jul 2005 16:57
21 lines
1958 bytes
"Bud Manz" <amanz@northweststate.edu> wrote in message
news:42e6bf3e$1@newsgroups.borland.com...

> If my understanding is correct, the try block will "try" a
> block of instruction(s) and return an error code to the catch
> block upon completion.

No, that is not how exceptions work.  Your understanding is not correct.
When an exception is thrown, the code in the try block is not run to
completion.  Code execution immediately jumps from the place the exception
is thrown to the nearest catch block that knows how to handle the exception.
If there is no catch block that can handle the exception, or if a catch
block re-throws the exception, then the exception travels up the call stack
until the next suitable catch block is found, and so on, until either the
exception is finally handled and discarded, or until the exception reaches
the system's main exception handler, which usually terminates the process
immediately.


Gambit
Re: Authenticate problem
#3564
Author: Bud Manz
Date: Thu, 01 Sep 2005 15:30
34 lines
2453 bytes
Ok, Thanks!

I did finally get past that, but now when I finally get to the IdSMTP1->Send(IdMessage1); instruction, the program blows up with an error message that says "...raised exception class EIdProtocolReplyError with message '250 2.1.5 <amanz@northweststate.edu>... Recipient ok'. Process stopped. Use Step or Run to continue.".

Can you (or anyone) help me with this?

Thanks in advance,
Bud

"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"Bud Manz" <amanz@northweststate.edu> wrote in message
>news:42e6bf3e$1@newsgroups.borland.com...
>
>> If my understanding is correct, the try block will "try" a
>> block of instruction(s) and return an error code to the catch
>> block upon completion.
>
>No, that is not how exceptions work.  Your understanding is not correct.
>When an exception is thrown, the code in the try block is not run to
>completion.  Code execution immediately jumps from the place the exception
>is thrown to the nearest catch block that knows how to handle the exception.
>If there is no catch block that can handle the exception, or if a catch
>block re-throws the exception, then the exception travels up the call stack
>until the next suitable catch block is found, and so on, until either the
>exception is finally handled and discarded, or until the exception reaches
>the system's main exception handler, which usually terminates the process
>immediately.
>
>
>Gambit
>
>
Re: Authenticate problem
#3565
Author: Bud Manz
Date: Thu, 01 Sep 2005 19:39
76 lines
3904 bytes
Hi,

I thought a code sample might help...

[code]
                IdMessage1->Body->Text = Memo2->Lines->Text;
                int error;
                AnsiString ErrMsg;
                try
                        {
    	                IdSMTP1->Send(IdMessage1);
                        }
                catch(EIdProtocolReplyError &E)
                        {
                        error = E.ReplyErrorCode;
                        ErrMsg = E.Message;
                        Memo3->Lines->Append(ErrMsg);
                        Memo3->Lines->Append("");
                        }
                catch(EIdConnClosedGracefully &E)
                        {
                        Memo3->Lines->Append(E.Message);
                        Memo3->Lines->Append("");
                        }
                catch(EFOpenError &E)
                        {
                        Memo3->Lines->Append(E.Message);
                        Memo3->Lines->Append("");
                        }
                catch(...)
                        {
                        Memo3->Lines->Append("Unidentified error!");
                        Memo3->Lines->Append("");
                        }
[/code]

Hope this helps...
Bud

"Bud Manz" <amanz@northweststate.edu> wrote:
>
>Ok, Thanks!
>
>I did finally get past that, but now when I finally get to the IdSMTP1->Send(IdMessage1); instruction, the program blows up with an error message that says "...raised exception class EIdProtocolReplyError with message '250 2.1.5 <amanz@northweststate.edu>... Recipient ok'. Process stopped. Use Step or Run to continue.".
>
>Can you (or anyone) help me with this?
>
>Thanks in advance,
>Bud
>
>"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>>
>>"Bud Manz" <amanz@northweststate.edu> wrote in message
>>news:42e6bf3e$1@newsgroups.borland.com...
>>
>>> If my understanding is correct, the try block will "try" a
>>> block of instruction(s) and return an error code to the catch
>>> block upon completion.
>>
>>No, that is not how exceptions work.  Your understanding is not correct.
>>When an exception is thrown, the code in the try block is not run to
>>completion.  Code execution immediately jumps from the place the exception
>>is thrown to the nearest catch block that knows how to handle the exception.
>>If there is no catch block that can handle the exception, or if a catch
>>block re-throws the exception, then the exception travels up the call stack
>>until the next suitable catch block is found, and so on, until either the
>>exception is finally handled and discarded, or until the exception reaches
>>the system's main exception handler, which usually terminates the process
>>immediately.
>>
>>
>>Gambit
>>
>>
>
Re: Authenticate problem
#3487
Author: Remy Lebeau (TeamB)
Date: Tue, 06 Sep 2005 05:26
24 lines
2080 bytes
"Bud Manz" <amanz@northweststate.edu> wrote in message
news:43171e80$1@newsgroups.borland.com...

> I did finally get past that, but now when I finally get to the
> IdSMTP1->Send(IdMessage1); instruction, the program blows
> up with an error message that says "...raised exception class
> EIdProtocolReplyError with message '250 2.1.5
<amanz@northweststate.edu>...
> Recipient ok'. Process stopped. Use Step or Run to continue.".

You did not specify which version of Indy you are using.  Offhand, you
should NOT be getting that exception at all.  The only way an
EIdProtocolReplyError can be thrown is if the server sends back a reply code
that is different than what TIdSMTP expects.  However, reply code 250 is a
valid reply code when specifying the recipients for a message.

You need to provide more details.  Please attach one of the TIdLog...
components to TIdSMTP, or use an external packet sniffer such as Ethereal
(http://www.ethereal.com), to see what the actual SMTP commands and replies
look like.


Gambit
Re: Authenticate problem
#3496
Author: Bud Manz
Date: Wed, 07 Sep 2005 01:11
36 lines
2523 bytes
Thanks for your reply, I am using the Indy component (V6 I think) that 
ships with BCB6.  I also realize that that is probably the problem.  I 
am going to install Indy 9 and see what happens.

Bud

Remy Lebeau (TeamB) wrote:
> "Bud Manz" <amanz@northweststate.edu> wrote in message
> news:43171e80$1@newsgroups.borland.com...
> 
> 
>>I did finally get past that, but now when I finally get to the
>>IdSMTP1->Send(IdMessage1); instruction, the program blows
>>up with an error message that says "...raised exception class
>>EIdProtocolReplyError with message '250 2.1.5
> 
> <amanz@northweststate.edu>...
> 
>>Recipient ok'. Process stopped. Use Step or Run to continue.".
> 
> 
> You did not specify which version of Indy you are using.  Offhand, you
> should NOT be getting that exception at all.  The only way an
> EIdProtocolReplyError can be thrown is if the server sends back a reply code
> that is different than what TIdSMTP expects.  However, reply code 250 is a
> valid reply code when specifying the recipients for a message.
> 
> You need to provide more details.  Please attach one of the TIdLog...
> components to TIdSMTP, or use an external packet sniffer such as Ethereal
> (http://www.ethereal.com), to see what the actual SMTP commands and replies
> look like.
> 
> 
> Gambit
> 
> 
Re: Authenticate problem
#3497
Author: Remy Lebeau (TeamB)
Date: Wed, 07 Sep 2005 01:56
19 lines
1548 bytes
"Bud Manz" <amanz@northweststate.edu> wrote in message
news:431e3df9$1@newsgroups.borland.com...

> I am using the Indy component (V6 I think) that ships with BCB6.

BCB6 ships with Indy 8, which is an outdated version that is no longer
supported.

> I also realize that that is probably the problem.

Probably.

> I am going to install Indy 9 and see what happens.

Ok.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads