Search The ForumSearch   RegisterRegister  LoginLogin

MailBee SMTP

 AfterLogic Forum : MailBee SMTP
Subject Topic: SMTP object events Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
rubi
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 14 August 2005 at 8:07am | IP Logged Quote rubi

Hi!
I am evaluating the smtp/ssl product for VB, version 5.2, my question is:
there are 5 events for using the async mail sendin: sent/connected/completed, which is fine, but what if there was an error in the way, what events will i be reported then, because the Send() method is supposed to return immediatedly.

I hope this could be answered
thanx
Back to Top View rubi's Profile Search for other posts by rubi
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 14 August 2005 at 9:47am | IP Logged Quote Alex

In the case of error, Send method will return an error rather than raise any event.

For example:

Code:

...
If Not SMTP.Send Then
  MsgBox "Error #" & SMTP.ErrCode
  MsgBox "Last server response:" & _
    SMTP.ServerResponse
End If


This approach does not depend on whether EnableEvents is True or False. You can use it in both cases.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
rubi
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 17 August 2005 at 10:35am | IP Logged Quote rubi

Sorry for my mistake on the www.iforum.com ...

But still the question is not fully answered, if I fail to connect or fail to send, not an immediate error, but a timeout or dns failure, where will I get the error event.

thanks, and sorry again for my mistake!
Back to Top View rubi's Profile Search for other posts by rubi
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 17 August 2005 at 12:39pm | IP Logged Quote Alex

Once error occurred, no matter it's immediate or not, the component will immediately return from async method, and you can check .ErrCode/.ServerResponse properties for error information.

There will be no any delay since error occurred and the component's method finished. So, from error checking point of view, there is no difference between async and sync methods.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
rubi
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 18 August 2005 at 3:46am | IP Logged Quote rubi

thank you for responding but I still havent completely understood how async errors are covered.
I understand that if you give an async method bad parameters, it may return that bad parameters were specified, but if a connect method takes 10 seconds, and the function is async it returns in 1 ms, the error might come after the timeout has reached ... sad, so how do I get the error than?

thanks for holding on
Back to Top View rubi's Profile Search for other posts by rubi
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 18 August 2005 at 9:46am | IP Logged Quote Alex

In MailBee, async function does not return until the method is completed (either successfully or not). In other words, it's not exactly "async" in common meaning of this word. It rather means that Windows events are processed while "async" method is executed and UI does not freeze. But from programmer point of view, MailBee "async" method are very similar to ordinary sync methods.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
rubi
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 21 August 2005 at 5:02am | IP Logged Quote rubi

Thanks!
I guess this is a reasonable approach, cuts down the need for multiple timers..
Back to Top View rubi's Profile Search for other posts by rubi
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide