-
Notifications
You must be signed in to change notification settings - Fork 2
Put your emails into a shared database.
License
RobFisher/mailshare
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Mailshare receives email and presents it in a web interface. CC your discussions to your Mailshare server's email address. Emails can then be viewed in a web browser. This is intended to be used in a team as an alternative to forwarding emails to the whole team. License ======= See https://github.com/RobFisher/mailshare/blob/master/LICENSE Status ====== Just starting so few features, but it is already somewhat useful. Installation ============ 1. Copy the file settings_example.py to settings.py 2. Edit settings.py, supplying database details for storing emails and IMAP details for retrieving them. 3. Create a database with MySQL, e.g.: mysql -u root -p CREATE DATABASE mailshare 4. Let Django set up the database: python manage.py syncdb Say yes and answer the prompts when asked to set up a super user for Django's authentication system. Later this will be used for the admin interface. 5. Set up full text search with MySQL, e.g.: sudo cp mailshare/mysql/mailshare.cnf /etc/mysql/conf.d sudo service mysql restart mysql -u root -p USE mailshare; ALTER TABLE mailshareapp_mail ADD FULLTEXT(body, subject) The config file sets the minimum word length for full text search to 3. After that you are just creating the index. Use === python manage.py shell >>> import mailshareapp.process_emails >>> mailshareapp.process_emails.quick_test() This downloads 10 emails from the email server and puts them into the database. You should now have a database containing up to 10 emails. All information from the mail server is also logged to a file called mailfile. You can delete the database and replay previously downloaded messages from this file with: >>> mailshare.mailshareapp.process_emails.quick_test(True) To view the database contents, start the Django test server with: python manage.py runserver Visit http://localhost:8000/admin/mailshareapp/mail/ to see the emails. Once you are happy that the IMAP connection is working, you can start the full email polling process. In settings.py, make sure that MAILSHARE_IMAP_ENABLE_EXPUNGE is set to True. Then: poll_mail.sh This just calls poll_mail.py which sets up the Django environment then runs mailshareapp.process_emails.poll_emails which runs forever, retrieving 10 emails at a time, adding them to the database, then deleting them. Environment =========== For information, here is how I set up my environment in Ubuntu 10.04. Other platforms will be supported but I have to start somewhere. Install these Ubuntu packages: lampserver^ libabache2-mod-python phpmyadmin - Apache and MySQL; hook Apache up to Python; and phpMyAdmin to see what the database looks like. python-MySQLdb - Hook Python up to MySQL. python-lxml - used to sanitise HTML from emails. Python libraries: sudo apt-get install python-setuptools sudo easy_install django sudo easy_install django-dajaxice sudo easy_install django-dajax Deployment ========== (See also http://blog.stannard.net.au/2010/12/11/installing-django-with-apache-and-mod_wsgi-on-ubuntu-10-04/ ) Commands to deploy Mailshare on an Ubuntu 10.04 server: sudo apt-get install git-core git clone git://github.com/RobFisher/mailshare.git sudo apt-get install mysql sudo cp mailshare/mysql/mailshare.cnf /etc/mysql/conf.d/ sudo service mysql restart sudo apt-get install apache2 sudo apt-get install apache2 libapache2-mod-wsgi sudo apt-get install python-setuptools sudo easy_install django sudo easy_install django-dajaxice sudo easy_install django-dajax sudo apt-get install python-MySQLdb sudo apt-get install python-lxml sudo mkdir /srv/www sudo ln -s `readlink -f mailshare` /srv/www/mailshare sudo cp mailshare/apache/mailshare_site /etc/apache2/sites-available/mailshare sudo a2ensite mailshare sudo /etc/init.d/apache2 reload cd mailshare cp settings_example.py settings.py vim settings.py # fill in database and IMAP settings; enable IMAP_EXPUNGE; # add /srv/www/mailshare/templates to TEMPLATE_DIRS mysql -u root -p mysql> CREATE DATABASE mailshare; mysql> quit python manage.py syncdb mysql -u root -p mysql> USE mailshare; mysql> ALTER TABLE mailshareapp_mail ADD FULLTEXT(body, subject); bmysql> quit # The web server needs permission to write into the cache directory sudo chgrp www-data cache chmod ug+w cache # whenever you change source code (including settings.py): touch mailshare/apache/mailshare.wsgi
About
Put your emails into a shared database.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published