in reply to Email Thresholding
Store the last time an email was sent as the create/modification date of a file (or as data within the file). Check the time elapsed every time you want to send another email.
if ($condition_requires_email) { if (-e 'last.email' && -M 'last.email' < 1.0/24.0) { print "Don't need to send email yet\n"; } else { &send_email(); system('touch','last.email'); } }
Update: corrected logic error pointed out by jhourcle.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Email Thresholding
by jhourcle (Prior) on Apr 05, 2015 at 05:38 UTC |