Farhad Fouladi > App-Birthday-0.2 > birthday

Download:
App-Birthday-0.2.tar.gz

Annotate this POD

View/Report Bugs
Source   Latest Release: App-Birthday-0.3

NAME ^

birthday

SYNOPSIS ^

birthday <option>

OPTION ^

   -h : help
   -i <file> : user defined input file, default "birthday.json"
   -c <file> : user defined configuration file, default "config.json"
   -x        : send to all users in "config.file", no date verification

DESCRIPTION ^

It sends birthday e-mails to your friends, on their anniversary date.

I have a bad habit that I almost always forget the birthdays of my friends and colleagues. To solve this, I try to 'cheat' and write this script and add it to my crontab.

It sends an e-mail at his/hers anniversary date to a friend and a reminder to me. (The other way, there was a risk that I forget again!) Additionally all your common friends receive reminders that your friend has his/hers birthday today.

The list of birthday children are saved in a JSON file, default is birthday.json, in the same directory as script. Any other file can be selected using option -i. See below for file format.

Additionally you need a configuration file for your e-mail system. This file is also in JSON format and default is configuration.json, in the same directory as script. The file format is described below. Any other file can be selected using option -c.

Input Format

The format of input file can be best described by an example. Imagin Bob has 3 friends: Carol, Ted, Alice. The following JSON structure can be saved, e.g. in birthday.json.

    {
        "carol" : {
            "date" : "16.9",
            "friends" : { 
                "names" : ["ted"],
                "subject" : "Carol has today birthday!"
            },
            "email" : "carol@somewhere.com",
            "subject" : "Happy Birthday Carol!",
            "text" : "Dear Carol, \nhappy birthday and all the best wishes \n\nYours,\nBob"
        },
        "ted" : {
            "date" : "25.11",
            "friends" : { 
                "names" : ["carol", "alice"],
                "subject" : "Ted has today birthday!"
            },
            "email" : "ted@another.com",
            "subject" : "*** Happy Birthday! ***",
            "text" : "Dear Ted, \n happy birthday \n\nRegards,\nBob"
        },
        "alice" : {
            "date" : "5.12",
            "friends" : { 
                "names" : ["other"],
                "subject" : "Alice has today birthday!"
            },
            "email" : "alice@somewhere.com",
            "subject" : "*** Happy Birthday! ***",
            "text" : "Dear Alice, \n happy birthday \n\nRegards,\nBob"
        }
    }

then at 16.9 (16th Sept.) following mails will be sent:

    bob -> carol    # congratulation mail
    bob -> ted      # reminder mail - carol has birthday
    bob -> bob      # copy of congratulation mail - bob email in F<configuration.json>

If word others as his/her only friend is inserted, all users minus birthday person in input file, will receive an reminder email. For example in above file, following reminder e-mails will be sent at 5th of Dec.:

    bob -> ted
    bob -> carol

The option -x will send to all your friends e-mails without consideration to value of the "date" (their birthday). It can be for example used for 'xmas' congratulations or an invitation.

Configuration Format

The format of configuration file can be best described by an example.

    {
        "from" : "bob@mycompany.com",
        "maintainer" : "bob@myhome.com",
        "transport" : {
            "host" : "mail.mycompany.net",
            "port" : "25"
        }
    }

Maintainer will receive an e-mail reminder, that he sent a birthday e-mail.

For example in above example Bob receive a copy of birthday e-mails at his "bob@myhome.com".

Usage Examples

AUTHOR ^

Farhad Fouladi

syntax highlighting: