Mail Reminder Plugin (version 1.000)
The MailReminderPlugin handles the tag
%MAILREMINDER_PLUGIN% that inserts a monthly calendar in the page and It allows you to send reminders before those events. It is the extension of Calendar Plugin. I have modified the existing code of Calendar Plugin so as to enable it to send reminders befores the date of event. A mail is send before the event to remind the calendar user, Which is sent at email id
specified. We use cronjob , which will be invoked at 00:01 am and will compare today's date with the reminer date of events and send mail to the appropriate users whose reminder date matches with today's date.
Usage example
| You type: | You get: | If correctly installed: |
Following are the configurations for user name and email address. just copy into your page ;
+ Name = YOUR NAME
+ email = yourid@domainPLEASENOSPAM.com
+ reminder = 3
( Reminder tells the no. of days before the event it should send email )
Specify list of events as following using bullets:
- 2 Feb - Andrea's birthday
- 7 Mar - Nicoletta's birthday
- 29 May 1996 - Maria Teresa is born!
- 29 Sep 1998 - Davide is born!
To delete the events from reminder list present in the database
- 29 Sep 1998 - Davide is born!
%MAILREMINDER_PLUGIN{month="2" year="2002" bgcolor="cyan"}%
%MAILREMINDER_PLUGIN{month="3" year="2002" showweekdayheaders="1"}%
|
| February 2002 |
| |
|
|
|
|
1 |
2 Andrea's birthday |
| 3 |
4 |
5 |
6 |
7 |
8 |
9 |
| 10 |
11 |
12 |
13 |
14 |
15 |
16 |
| 17 |
18 |
19 |
20 |
21 |
22 |
23 |
| 24 |
25 |
26 |
27 |
28 |
|
|
|
| March 2002 |
| Sunday |
Monday |
Tuesday |
Wednesday |
Thursday |
Friday |
Saturday |
| |
|
|
|
|
1 |
2 |
| 3 |
4 |
5 |
6 |
7 Nicoletta's birthday |
8 |
9 |
| 10 |
11 |
12 |
13 |
14 |
15 |
16 |
| 17 |
18 |
19 |
20 |
21 |
22 |
23 |
| 24 |
25 |
26 |
27 |
28 |
29 |
30 |
| 31 |
|
|
|
|
|
|
|
|
%MAILREMINDER_PLUGIN{month="2" year="2002" bgcolor="cyan"}%
%MAILREMINDER_PLUGIN{month="3" year="2002" showweekdayheaders="1"}%
|
Syntax
| You type |
you get |
| %MAILREMINDER_PLUGIN% |
a monthly calendar for the current month/year, with events taken from the current topic |
| %MAILREMINDER_PLUGIN{<attributes>}% |
is the full syntax |
User settings Event settings and Setting to delete event from database - Syntax
User set the Various information parameters as follows:
| Command type |
Syntax |
Example |
| Specify Name : |
+ Name = YOUR NAME |
+ Name=Naval |
| Specify email : |
+ email= Yourid@yourdomain |
+ email = naval@itPLEASENOSPAM.iitb.ac.in |
| Reminder before days : |
+ reminder = number of days before the event |
+ reminder=3 |
| Specify event: |
* dd MMM yyyy - description |
* 09 Dec 2002 - Expo |
| Delete event: |
- dd MMM yyyy - description |
- 09 Dec 2002 - Influence 02 |
Default settings
- One line description, shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Show a monthly calendar with highlighted events
- How the cell content is formatted
* Set FORMAT = $old <br /> $description
- Note: You can add settings of any of the recognized attributes (in upper case like SHOWWEEKDAYHEADERS)
Plugin Installation Instructions
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
- Download the ZIP file from the Plugin web (see below)
- The Plugin uses the
HTML::CalendarMonthSimple and Date::Calc CPAN packages (see http://www.cpan.org
)
- Install
Date::Calc
- Install
HTML::CalendarMonthSimple
- Install
Mail::SendEasy
- Install perl's
DBI module
- Change line 197 of CalendarMonthSimple.pm as follows to avoid an annoying log message:
if ($self->year = $todayyear && $self->month = $todaymonth <font color="red">&& defined $thisday</font> && $thisday = $todaydate)=
- Unzip
MailReminderPlugin.zip in your twiki installation directory. Content: | File: | Description: |
data/TWiki/MailReminderPlugin.txt | Plugin topic |
data/TWiki/MailReminderPlugin.txt,v | Plugin topic repository |
lib/TWiki/Plugins/MailReminderPlugin.pm | Plugin Perl module |
lib/TWiki/Plugins/MailReminderPlugin/cron.pl | Plugin Perl module |
lib/TWiki/Plugins/MailReminderPlugin/config_file | Plugin configruraion file |
lib/TWiki/Plugins/MailReminderPlugin/calender_config_file | Plugin configruraion file |
pub/TWiki/MailReminderPlugin/exclam.gif | Image file |
Create Table to store events in my database
Structure of table is as follows:
| Field |
Type |
Null |
Key |
| name |
varchar(30) |
YES |
|
| e_date |
date |
|
PRI |
| r_date |
date |
YES |
|
| email_id |
varchar(100) |
|
PRI |
| event |
varchar(200) |
|
PRI |
Mysql query to create table is :
Create table caltab(name varchar(30), e_date date not Null ,r_date date, email_id varchar(100) not Null, event varchar(200) not Null, primary key(e_date, event, email_id));
Edit cront tab as follows to make entry for cronjob :
In shell prompt execute :- crontab -e [Enter]
- Vi editor will be opened make the following crontab entry and save the file:-
- 01 00 * * * /[path of your lib/TWiki/Plugin directory]/MailReminderPlugin/cron.pl
Make changes in configuration files
- In /[Path of Plugins Directory]/MailReminderPlugin/calender_config_file :- Should be configured with various database related settings like database host ,database user , database password , database name.
- In /[Path of Plugins Directory]/MailReminderPlugin/config_file :- Should be configured with various database settings and mail related settings like Smtp server name , email of sender etc.
Plugin Info
Related Topics: TWikiPreferences,
TWikiPlugins
--
TWiki:Main/AshishNaval
- 03 Nov 2004