SEND EMAIL

User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: SEND EMAIL

Post by James Bott »

Enrico,

>I don't like it very much because I still don't know what the error is so I can't trap it.

You don't need to know what it is, just loop back from where the msgInfo() displaying the error message (the one after the send).

James
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: SEND EMAIL

Post by James Bott »

Enrico,

Here is a sample using a loop on error (not tested).

James

Code: Select all

   local lError :=.f.
   local nCounter:=0
   local nTrys:=3
   local nWait:= 5 // in seconds
   
   ...
   
   do while lError .and. nCounter < nTrys
       TRY
          oEmailMsg := CREATEOBJECT ( "CDO.Message" )
          WITH OBJECT oEmailMsg
            ...
            :Send()
          END WITH
          SysRefresh()
       CATCH oError
          lError:=.t.
          nCounter++
          waitSeconds( nWait )
       END
   enddo

 
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: SEND EMAIL

Post by Enrico Maria Giordano »

James Bott wrote:Enrico,

>I don't like it very much because I still don't know what the error is so I can't trap it.

You don't need to know what it is, just loop back from where the msgInfo() displaying the error message (the one after the send).

James
Still I don't like it very much. :-) I prefer to know what I deal with... :-)

EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: SEND EMAIL

Post by Enrico Maria Giordano »

James Bott wrote:Enrico,

Here is a sample using a loop on error (not tested).
Thank you.

EMG
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: SEND EMAIL

Post by James Bott »

Enrico,

I just realized that you are probably going to need to set oError to nil in the CATCH oError routine--even if just for clarity.

James
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: SEND EMAIL

Post by Enrico Maria Giordano »

Ok, thank you. I'm still waiting the client report after your SysRefresh() suggestion... :-)

EMG
Post Reply