SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

Flexible Mail Notifier
Release 0.02
April 20th, 2005

Installation

Extract this archive and run:
python setup.py [options]

options
usage
[option]=[value] ie: --home_dir=$HOME --bin_dir : default "/usr/local/bin" location of bin dir --lib_dir: default "/usr/lib/python2.3/" location of python lib directory --home_dir: default $HOME location of installing user's home directory --server_dir: default "/usr/lib/bonobo/servers/" bonobo server directory

What is It?

FMN is a mail notifier that lets you specify specific actions based on the email sender's email address.

The core library is crossplatform, and the initial UI interface is a Gnome Applet.

To use:
Install then from Gnome, right click on a panel and select "Add To Panel...".

In the resulting window, scroll down until you see "Mail Notifier". Select "Mail Notifer" and click the "Add" button.

Mail notifier should appear. Right click on applet, and select "Preferences"

Click the "New" button.

In the resulting dialog, select the Account type, from the combo box. Either mailnotifier.fmnpoplib.POPAccount (for pop accounts) or mailnotifier.fmnimaplib.IMAPAccount (for imap accounts).

New values will need to be entered at this point depending on the account type you've selected:

POPAccount
username: the user name used to log into the pop account password: the password used to log into the pop account

-> This will be displayed in plain text on your screen


server: the pop server you connect to get your mail stateToken: When changing the mode of fmn(see below), this token must be included in the subject. (this allows you to controll multiple computers (your desktop, your laptop, etc) with fmn installed.)
IMAPAccount
username: the user name used to log into the pop account password: the password used to log into the pop account

-> This will be displayed in plain text on your screen


server: the pop server you connect to get your mail stateToken: When changing the mode of fmn(see below), this token must be included in the subject. (this allows you to controll multiple computers (your desktop, your laptop, etc) with fmn installed.) SSL: Enter "True" (no quotes) to contact your IMAP server via SSL or "False" to use normal sockets [untested!] mailbox: Enter "INBOX" to select your INBOX, or another name for a different mail box.

Click Save.

Select your new account from the combo box.

Click "Add New Email"

Enter an email address (ie: myddrin@myddrin.com) and click Save.

Double-click your new entry.

On the right hand side of the preference window, click the upper "New Action" button. A dialog will appear with a combox box, this allows you to select the action that should be taken. Currently your options are "mailnotifier.clickatell.Clickatel", "mailnotifier.screen.ScreenNotify" and "mailnotifier.autorespond.SMTPRespond". Click "Ok".

Several new options will appear based on you r selection as below:

mailnotifier.clickatell.Clickatel: An SMS message will be sent to your cellphone when this action is specified. The message is customizable, and you MUST have a clickatell account (http://www.clickatell.com) [useful for very important messages when you are away from your desk!)

user: your clickatell username
password: your clickatell password
apiid: your clickatell apiid (you get this when you sign up) cellphone: your cellphone number (with international country number as one string: so for example an american number of 123-555-2344 would be 11235552344 msg: The message to send your cellphone. You can reference the sender, subject or date of transmission as follows: %(sender)s will be replaced by the sender's email address %(date)s will be replaced by the date of transmission %(subject)s will be replaced by the subject of the email

example
Msg from %(sender)s, subject: %(subject)s
mailnotifier.screen.ScreenNotify:A dialog box will appear when this action is specified. The message is customizable msg: The message to reply with. You can reference the sender, subject or date of transmission as follows: %(sender)s will be replaced by the sender's email address %(date)s will be replaced by the date of transmission %(subject)s will be replaced by the subject of the email
example
Msg from %(sender)s\nSubject: %(subject)s
mailnotifier.autorespond.SMTPRespond:Responds by sending an email back to the original sender. The message is customizable.

msg: The message to reply with. You can reference the sender, subject or date of transmission as follows: %(sender)s will be replaced by the sender's email address %(date)s will be replaced by the date of transmission %(subject)s will be replaced by the subject of the email

sender: the email address to send the response from (usually the same as the account) username: the user name used to log into the SMTP server password: the password for the SMTP server smtpserver: the SMTP server used to send the email example:
I am away from my desk. If %(subject)s is an emergency you can reach me at [insert your emergency contact info here].

At this point you have set up an action to be used when you are at your desk. To set up different acctions when you are away from your desk, use the "Add Action" on the lower half of the screen. (Step as the same.)

Modes
FMN supports 2 modes "Offline" and "Online". The applet starts in online mode.

The mode can be changed in 2 ways:
1) Using the context menu on the applet. Right click and the menu will display either "Offline Mode" (which will put the applet in Offline mode or "Online Mode" which will put the applet in Online Mode.

2) Via email. To change the mode of an account when you are away from your desk, send an email to your account with a subject of either "Offline stateToken" (to put it in Offline mode) or "Online stateToken" (to put it in ONline mode). There should be no quotes in the subject, and you should replace stateToken with the stateToken assigned to the account.

For example, if when I set up my email, I selected a stateToken of Main, then I would send an email with the subject of Offline Main to the account to change the mode to Offline.

Creating Your Own Account Types

Account inherit from mailnotifier.core.Account and must implement the following interface: class Account

        pararms = list() # a list of the creation paramers in order
        def checkMail(self):
                # this function connects to the server,
                # gets the messages
                # creats an email object from the results
                # calls self.ApplyActions on each message to 
                # process email
                # returns a tuple of the number of important messages, unimportant messages, and messages that are part of a mailing list.
        def fromXML(self, node):
                #this will be handed an xml.dom.minidom.Node object
                # it must parse the object to populate its state vars
        def toXML(self):
                #this must return an xml representation of the object
                # the only requirement is that the root node must
                # be "account"

mailnotifier.fmnpoplib.POPAccount and mailnotifier.fmnimaplib.IMAPAccount should provide adequate examples.

When utilizing your new account type, click the "Register New Type" button on the new account dialog. In the result dialog, enter the module name and object name in the new account dialog. For example if your module's name was foo and the class name was bar, your would enter foo.bar .

Creating Your Own Actions

        The action interface is almost the same as the account interface.
        class Action:
                name = ""  # this should be set to the module name of the class
                params = list() # a list of the creation paramers in order
        
                def sendMessage(self, email):
                        # email is an email.Email object (from the python core libs
                        # this function does the actual work of 
                        # the action

Known Issues:
1) under some circumstances actions are added to both lists. This appears to be when the app is first installed. Logging out and then back in resovles the issue. 2) The UI is still very kludgy, however now your entries are remembered...reducing the amount of text that the user needs to input on subsequent tries 3) only plain text POP passwords are currently supported 4) md5-cram is not support on IMAP, currently. 5) Because many IMAP users leave their emails on the server for extended periods, the list of processed messages is stored on exit...This has been tested, but I'm still nervous about it working right.

To Do:
1) Add support for non-plain text POP passwords 2) Allow accounts and actions to specify their own UI for setting parameters. (Make the UI cleaner, and allow obsufication(sp?) of sensitive data.)


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.