Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Email upon a record being appened to table
Message
From
01/08/2005 14:19:33
 
 
To
01/08/2005 13:38:50
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01035803
Message ID:
01037564
Views:
22
>Have you ever used CDOSYS ?
>I am running into a problem when it gets to .send()
>Error 1429
>The server response was not available.
>
>Any thoughts?
>
>
>Andy
>
>>>In V6 is there a way to set up a trigger to send an email out
>>>when a record is added to a table with the data that is
>>>in that record?
>>>
>>>If not any suggestions how to handle that?
>>>
>>>thanks
>>>Andy
>>
>>Andy,
>>Check Graig's BLOG, how to send an eMail from VFP.
>>http://www.sweetpotatosoftware.com/SPSBlog/

Andy,

Whatever method to send mail you use, you must be prepared for it to fail

I think a trigger should never fail because a mail cannot be sent

One way to implement is as follows

Make a class MailQueue and instantiate it at the beginning of your application or when needed (max one instance running)

A trigger may queue a mail, ie pass the data to the queue by calling a method, and return fast. Under no circumstance may it fail, ie if the object does not exist or the queue command fails, the trigger must still return TRUE

The MailQueue has a timer that is fired every so often (eg 60 seconds or more).
When it fires it tries to send a mail from the Queue. If a send of a single mail fails, you retry (in the next timer cycle) up to max say 3 times. After that, discard the mail from the queue

If the sending of a mail is successful, continue sending until the queue is empty

When the MailQueue object destroys, it tries to send all the mail (once) that remains in the queue, and then destroys.



The MailQueue runs in its own datasession. Thus it can keep a table of the mails, and temp files (attachments)
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform