Isn't this as simple as running the script every Wed and Fri (say as a cron job), and sending an email for every due date that's [0..14] (or [1..14]*) days away from today?

For the last reminder,
On Wednesdays, check if the due date is [1..2] (or [0..1]**) days away from today.
On Fridays, check if the due date is [1..5] (or [0..4]**) days away from today.

* — If you don't want notifications on the due date.
** — If you want the special notification be to sent before the due date.

Update: Untested code:

use Date::Calc qw( Day_of_Week Delta_Days Today ); use List::Util qw( min ); my ($ty,$tm,$td) = Today(); for (...{ tasks }...) { my ($dy,$dm,$dd) = ...{ due date of task }...; my $delta = Delta_Days($ty,$tm,$td, $dy,$dm,$dd); next if $delta < 0; # Don't care about past-due tasks. next if $delta > 14; # Don't care about due dates that far ahead. my $ddow = Day_of_Week($dy,$dm,$dd); # $cc_super is true if this is the last # Wednesday or Friday before the due date. my $days_to_wed = (3 - $ddow) % 7; my $days_to_fri = (5 - $ddow) % 7; my $days_to_next = min $days_to_wed, $days_to_fri; my $cc_super = ( $delta > 0 && $delta <= $days_to_next ); send_reminder($cc_super, ...); }

Update: Fixed typo in code resulting in the error mentioned in reply.


In reply to Re: Finding the dates for the reminder mail system by ikegami
in thread Finding the dates for the reminder mail system by d-evil

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.