BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TIdSMTP Exception Handling

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Adagio
Guest





PostPosted: Thu Feb 16, 2006 12:03 pm    Post subject: TIdSMTP Exception Handling Reply with quote



I am writing a program to send emails to a mailing list in an Access table
using the TIdSMTP component. If an address is at an unknown domain then
naturally an exception is raised :-

"Project mailtommm.exe raised exception class EIdProtocolReply Error with
message . . . . . .'

I am attempting to handle this exception with the following code:-

try
SMTP.Send(Message);
except on E:EIdProtocolReplyError do
begin
Error.Text:=E.Message;
Error.Update;
end;


it does not work. I have tried E:EIdException and E:Exception with no
success. What am I doing wrong or omitting?

In case anyone should jump to the conclusion that I am spamming, the list is
to members of the Winchester & Portsmouth Diocesan Guild of Church Bell
Ringers. From time to time email addresses become extinct and the owner
fails to tell me!

David
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Feb 16, 2006 8:03 pm    Post subject: Re: TIdSMTP Exception Handling Reply with quote



"Adagio" <donthaveone (AT) anywhere (DOT) com> wrote in message
news:43f4577a$1 (AT) newsgroups (DOT) borland.com...

Quote:
"Project mailtommm.exe raised exception class
EIdProtocolReplyError with message . . . . . .'

EIdProtocolReplyError means that the SMTP server sent an error message back
to TIdSMTP in reply to a command that TIdSMTP sent to the server.

Quote:
I am attempting to handle this exception with the following code:-

You are only handling EIdProtocolReplyError and no other exceptions at all:

try
SMTP.Send(Message);
except
on E: Exception do
begin
Error.Text := E.Message;
Error.Update;
end;
end;

Quote:
it does not work.

Just saying it doesn't work says nothing about the actual problem you are
having. Always provide specific details. What exactly is happening?


Gambit
Back to top
Adagio
Guest





PostPosted: Thu Feb 16, 2006 10:03 pm    Post subject: Re: TIdSMTP Exception Handling Reply with quote



"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:43f4cfa4$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Adagio" <donthaveone (AT) anywhere (DOT) com> wrote in message
news:43f4577a$1 (AT) newsgroups (DOT) borland.com...

"Project mailtommm.exe raised exception class
EIdProtocolReplyError with message . . . . . .'

EIdProtocolReplyError means that the SMTP server sent an error message
back
to TIdSMTP in reply to a command that TIdSMTP sent to the server.

I am attempting to handle this exception with the following code:-

You are only handling EIdProtocolReplyError and no other exceptions at
all:

try
SMTP.Send(Message);
except
on E: Exception do
begin
Error.Text := E.Message;
Error.Update;
end;
end;

it does not work.

Just saying it doesn't work says nothing about the actual problem you are
having. Always provide specific details. What exactly is happening?


Gambit
I think I said in my original post that I have tried both E:EIdException and

E:Exception. The result is the same. I am sorry if the meaning of 'does not
work' was not clear. The same message box appears :-


"Project mailtommm.exe raised exception class EIdProtocolReply Error with
message . . . . . . Process stopped. Use Step or Run to Continue."

However, I have just tried running the executable outside the IDE and all
seems to be as I expected i.e. no message box. Please forgive my
inexperience.

David
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Feb 17, 2006 9:03 am    Post subject: Re: TIdSMTP Exception Handling Reply with quote

"Adagio" <donthaveone (AT) anywhere (DOT) com> wrote in message
news:43f4f39c$1 (AT) newsgroups (DOT) borland.com...

Quote:
I think I said in my original post that I have tried both
E:EIdException and E:Exception. The result is the same.

You did not say what is ACTUALLY happening.

Quote:
The same message box appears :-

"Project mailtommm.exe raised exception class EIdProtocolReply Error with
message . . . . . . Process stopped. Use Step or Run to Continue."

You are running your code inside the IDE debugger. What you see is
perfectly normal behavior. The debugger catches all exceptions before the
code does. Do what the message box tells you to do - use the "Run" command
(press F9, or use the menu item), and the exception will be passed back to
the code for normal handling. If your code never sees the exception, then
TIdSMTP is swallowing it internally.


Gambit
Back to top
Rodrigo Schiavo
Guest





PostPosted: Fri Feb 17, 2006 1:03 pm    Post subject: QUIZ FOR ALL Reply with quote

Hi, folks!!!


I'm a forum reader and I would like make a quiz for obtain your opinion
about an interesting subject.



Quiz:

What you consider secure to use into execute method of thread, and what
you prefer to use only in syncronize method?



My opinion:

I use only string handling routines in execute method, I avoid use
objects into execute method without syncronize. Sometimes I create
TClientDataSet's in execute method, nothing more.



Thanks for all replys.


[ ]'s Rodrigo Schiavo



* If can't create quiz in this forum, please close the thread.
Back to top
Martin James
Guest





PostPosted: Fri Feb 17, 2006 8:03 pm    Post subject: Re: QUIZ FOR ALL Reply with quote

Quote:

Quiz:

What you consider secure to use into execute method of thread, and what
you prefer to use only in syncronize method?


It that not a bit off-topic for this thread?

I prefer not to use a synchronized method for anything at all.

Quote:

My opinion:

I use only string handling routines in execute method,

What's the problem with other stuff? OK, the VCL is not thread-safe. Apart
from that, what else do you have a problem with? The fileSystem is
thread-safe, the memory-manager is thread-safe, the Windows API is obviously
thread-safe, (apart from some very specialised debugging subSystems).

Quote:
I avoid use
objects into execute method without syncronize.

?? Instantiating, calling methods, setting properties etc. are all fine for
those objects that are not VCL components or are not thread-safe for some
other reason. I have many apps that regularly exchange objects between
threads for communication purposes.

Quote:
Sometimes I create
TClientDataSet's in execute method, nothing more.

I think you are worrying too much <g>

Rgds,
Martin
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sat Feb 18, 2006 6:03 am    Post subject: Re: QUIZ FOR ALL Reply with quote

"Rodrigo Schiavo" <rodrigo.schiavo (AT) sti (DOT) ind.br> wrote in message
news:43f5c6b5 (AT) newsgroups (DOT) borland.com...

Quote:
I'm a forum reader and I would like make a quiz for obtain
your opinion about an interesting subject.

This topic does not belong in this newsgroup, let alone in this discussion
thread. You should have directed your posting to the .non-technical
newsgroup instead.


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.