Sample script to send email on timely fashion |
7/14/2010 8:40:21 AM |
PHPRunner Tips and Tricks | |
J
Jane author
Let's say there is an ExpiryDatefield in the table with events. <?php
$rstmp = $dalTableName->Query("DATEDIFF(day, GETDATE(), ExpiryDate)>0","");
$rstmp = $dalTableName->Query("DateDiff('d', Now(), ExpiryDate)>0","");
|
|
U
|
unsearcheable 5/9/2011 |
Great tip, but how can i add fields from another table ? Put all the select statement in query ? |
![]() |
Sergey Kornilov admin 5/9/2011 |
Use DAL's CustomQuery() function and put any SQL quey you want there. |
U
|
unsearcheable 5/9/2011 |
Thanks. |
O
|
oermops 9/18/2011 |
I have a similar situation. As a hobby I am involved with a train museum where I also maintain the personnel records. We have several tests that expire after a few years. I would like to have our engineers be notified by email when their test(s) have expire. Different tests have different expiration dates and need to have a pair of fields for each test. For example, test1 + 1 year =test1expired; test2 + 3 years = test2expired; test3 + 5 years = test3expired.... You get the idea. I am running MYSQL and PHPRunner doesn't accept the UPDATE commands I have tried to enter in the SQL editor. |
K
|
Kevin 11/23/2011 |
I have this script which will monitor oracle db process if up or down.And I want it to send email if it's down and the time it's back to online. However my script just keep on sending "Email Up" if the db is up or "Email Down" if the db is down.Is there any way to trap it so that it would only send Email Up or Down once? !/bin/shwhile : |
A
|
Anapolis 4/1/2014 |
[size="3"]Hello Jane and Sergey, |
![]() |
Sergey Kornilov admin 4/1/2014 |
There are thousands of ways to handle this. Probably the easiest one is to separate email generation and the the actual email sending processes. |
A
|
Anapolis 4/1/2014 |
There are thousands of ways to handle this. Probably the easiest one is to separate email generation and the the actual email sending processes. Run cron job once a day to generate emails. Instead of sending emails right away store them in a separate table. Run another cron job every few hours or minutes to send the next batch of emails say 1000 at a time. Scan the table with generated emails, send them out 1000 at once, delete those emails from the queue and enjoy.
global $dal;
|
![]() |
Sergey Kornilov admin 4/1/2014 |
There is no explanation. Tutorial assumes that emails are sent right away. |
A
|
Anapolis 4/1/2014 |
There is no explanation. Tutorial assumes that emails are sent right away. What you need to do is to create a new table with fields like to, body, subject etc and instead of sending emails store those emails in this table. Second cron job will pull emails from there and actually send them. I'm talking about a brand new functionality that needs to be implemented from scratch.
|