Giter Club home page Giter Club logo

email-archiver's Introduction

Discord

This project is currently in early development, and things may break unexpectedly.

Briefbox

Briefbox is a tool for archiving emails from multiple IMAP and POP3 accounts. It provides a user-friendly web interface for managing email accounts, searching archived emails, and viewing email details along with attachments. One of the standout features of Briefbox is its advanced search functionality, which allows users to quickly find specific emails using various criteria.

image image
image image

Prerequisites

  • Python 3.x
  • Node.js
  • npm

Setup and Usage

  1. Clone the repository:

    git clone https://github.com/bandundu/email-archiver.git
  2. Navigate to the backend directory:

    cd email-archiver/backend
  3. Create a virtual environment:

    python -m venv .venv
  4. Activate the virtual environment:

    source .venv/bin/activate
  5. Install the required dependencies:

    pip install -r requirements.txt
  6. Launch the backend:

    python app.py

    The backend will start running on http://localhost:5050.

  7. Open a new terminal and navigate to the frontend directory:

    cd ../frontend/briefbox-front
  8. Install the frontend dependencies:

    npm install
  9. Start the frontend development server:

    npm start

    The frontend will be accessible at http://localhost:3000.

  10. Access the web interface by opening a web browser and navigating to http://localhost:3000.

  11. Use the web interface to add email accounts, search for emails, and view email details.

Note: I apologize for the inconvenience, but I am are currently working on improving the Docker Compose setup for a smoother deployment experience. In the meantime, please follow the above steps for a bare-metal installation.

Star History

Star History Chart

email-archiver's People

Contributors

bandundu avatar

Stargazers

 avatar  avatar Illya Marchenko avatar  avatar JustMichael avatar  avatar Rux Lin avatar Alexander McGinn avatar  avatar  avatar Rasamaha avatar Seklier avatar Evan Sarmiento avatar Alex avatar Joe Carpita avatar Luke avatar Gergan Penkov avatar Oscar Romeu avatar  avatar Bernd Schorgers avatar Jordan avatar Knud Hollander avatar  avatar Abhishek Nair avatar Zacchary Puckeridge avatar  avatar  avatar  avatar André avatar Arthur Caranta avatar  avatar  avatar Xiaofei Ge avatar Darkham avatar Cendenta avatar  avatar  avatar Dave Onkels avatar Peter Buga avatar Seohyun Joo avatar Emhl avatar Felix Eckhofer avatar Giovannelli Alessandro avatar Siddharth Bhal avatar Jon avatar Vlad Vaviloff avatar  avatar Adam Shand avatar Piotr Sowa avatar  avatar  avatar Sven avatar  avatar Michał Gołąb avatar Pretzel Vector avatar  avatar Bruno Talanski avatar  avatar  avatar BenNi avatar David Johnson Jr avatar  avatar  avatar  avatar  avatar Riccardo Di Curti avatar Bruno Antunes avatar  avatar Emiliano Tosolini avatar Rahul Popuri avatar bozzfozz avatar Justin avatar  avatar Eric Klein avatar tom avatar  avatar Julien W avatar Roland Gaida avatar Bobo Jamson avatar Tony Tamplin avatar  avatar  avatar  avatar Vladislav Sorokin avatar x86fatah avatar  avatar  avatar  avatar  avatar Murtaza Nasir avatar  avatar Jacob Witt avatar Maxim Marshak avatar  avatar Valery Levchenko avatar Alexander Babenko avatar  avatar null data avatar  avatar amir avatar

Watchers

L.N. avatar  avatar Emiliano Tosolini avatar  avatar

email-archiver's Issues

read only IMAP

I'd like to use this to archive an IMAP mailbox, but with read only permissions. Getting this error:

email-archiver-web-1 | raise self.readonly('%s is not writable' % mailbox)
email-archiver-web-1 | imaplib.IMAP4.readonly: INBOX is not writable

Does the software need to have write access for some reason?

Handle TypeError for NoneType Object in fetch_and_archive_emails

          Better this time.  It was able to archive 1000 emails, but then hit the error:

email-archiver-web-1 | 2024-03-18 13:30:26,387 - ERROR - An error occurred during email archiving for account 1: 'NoneType' object is not subscriptable
email-archiver-web-1 | 2024-03-18 13:30:26,388 - ERROR - Exception details: Traceback (most recent call last):
email-archiver-web-1 | File "/app/email_archiver.py", line 133, in fetch_and_archive_emails
email-archiver-web-1 | raw_email = data[0][1]
email-archiver-web-1 | TypeError: 'NoneType' object is not subscriptable

Originally posted by @cirrusflyer in #11 (comment)

Umlaute not working in passwords for mail accounts

Got this error while adding a mail account:

web-1  | Traceback (most recent call last):
web-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1488, in __call__
web-1  |     return self.wsgi_app(environ, start_response)
web-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1466, in wsgi_app
web-1  |     response = self.handle_exception(e)
web-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1463, in wsgi_app
web-1  |     response = self.full_dispatch_request()
web-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 872, in full_dispatch_request
web-1  |     rv = self.handle_user_exception(e)
web-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 870, in full_dispatch_request
web-1  |     rv = self.dispatch_request()
web-1  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 855, in dispatch_request
web-1  |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
web-1  |   File "/app/app.py", line 58, in create_account
web-1  |     email_archiver.create_account(conn, email, password, protocol, server, port)
web-1  |   File "/app/email_archiver.py", line 257, in create_account
web-1  |     client.login(email, password)
web-1  |   File "/usr/local/lib/python3.9/imaplib.py", line 610, in login
web-1  |     typ, dat = self._simple_command('LOGIN', user, self._quote(password))
web-1  |   File "/usr/local/lib/python3.9/imaplib.py", line 1230, in _simple_command
web-1  |     return self._command_complete(name, self._command(name, *args))
web-1  |   File "/usr/local/lib/python3.9/imaplib.py", line 987, in _command
web-1  |     arg = bytes(arg, self._encoding)
web-1  | UnicodeEncodeError: 'ascii' codec can't encode character '\xdc' in position 10: ordinal not in range(128)

The mail Account password cotains an Ü

App Feedback and Ideas

First of all, thank you for making a nice utility for archiving our emails! This is very much needed in the self hosting community.

I have some usability suggestions if I may.

User Interface

  • I pay for my email hosting and as such have several e-mails which use the same server. I think adding a 'remember this server' box would be nice so we don't have to type it in (paste in my case) into the field every time.
  • When handling more than one email box, instead of lumping them into one giant list, group them by accounts.
  • While this may defeat the purpose of email archiving, the ability to selectively remove certain e-mails from the interface would be a plus.
  • Add an "About" section in the app so users can find this on Github (see below for why)
  • Add a server interval check or schedule to change the server polling time This is useful for if you want to manage your emails first and then set up a once a week archival of emails. One can work around this by turning off the server until ready, but then if one needs to find an email, you have to fire it up, so it's catch-22.

App Name/SEO Exposure
This is more or less a stumbling block I encountered, I discovered this through a blog (https://selfh.st/). When I came back to the app, I couldn't remember where this was in Github. So, a basic search online in a search engine, yielded many and I mean many results for "Briefbox" but nothing related to this.

General
Several projects here in GitHub utilize discussion groups within Github, this allows on topic discussion of the app while keeping the bugs and app issues contained within the "Issues" links.

Again, thank you for making this! This will fill the gap for the self-hosting community where the desire is to archive email.

LookupError for Unknown Encoding During Email Decoding

I now have this error:

2024-03-18 07:19:30,763 - ERROR - Exception details: Traceback (most recent call last):
  File "/app/email_archiver.py", line 155, in fetch_and_archive_emails
    decoded_sender_parts.append(part.decode(encoding or 'utf-8'))
LookupError: unknown encoding: unknown-8bit

I wonder why no mail has been archived yet. Is the operation only successful, if there is no error during the process? Because the logs show a lot of

2024-03-18 07:24:32,563 - INFO - Inserted email with UID b'18705' for account 1 into the database.

but still nothing in the dashboard.

Originally posted by @TheZoker in #12 (comment)

Archive cleaning functionality

Any plans to add functionality to clean unneeded e-mails ?
I imagine it by using the search function, pressing "Select all" and/or selecting/deselecting what I want to include/exclude and pressing delete button.

Otherwise this archive will quickly become a placeholder for a lot of spam messages.

Future Proof Frontend

To ensure features can be easily added in future on the front, the frontend should move from flask templates to full react based frontent application

SSL wrong version number

When I try to archive my mail, I get this error:

2024-03-14 14:42:38,964 - ERROR - Exception details: Traceback (most recent call last):
  File "/app/email_archiver.py", line 103, in fetch_and_archive_emails
    client = imaplib.IMAP4_SSL(server, port)
  File "/usr/local/lib/python3.9/imaplib.py", line 1324, in __init__
    IMAP4.__init__(self, host, port, timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 202, in __init__
    self.open(host, port, timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 1337, in open
    IMAP4.open(self, host, port, timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 312, in open
    self.sock = self._create_socket(timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 1328, in _create_socket
    return self.ssl_context.wrap_socket(sock,
  File "/usr/local/lib/python3.9/ssl.py", line 501, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.9/ssl.py", line 1074, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.9/ssl.py", line 1343, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)

I use IMAP with the port 143.

These are the ports provided by my hoster:

image

Which combination should I use to get this working? Thanks!

Enable users to select inboxes to archive within account setup

When using IMAP protocol, users should be able to select what available inboxes should be archived. Users should also be able to edit this later and add or remove inboxes afterward. Users should also have the possibility when deselecting a previously selected inbox to delete all mails of this inbox.

json to eml?

Hi
Currently trying to few the emails, but its in json format, any ideas how to convert it to eml?

Thank you

ARM docker

Please add a ARM docker version. For use on raspberry pi this would be great :) thanks.

ERROR - An error occurred during email archiving for account 1: expected string or bytes-like object

Log from start of Account 1 to Account 2:


2024-03-18 14:37:39,288 - ERROR - An error occurred during email archiving for account 1: expected string or bytes-like object

2024-03-18 14:37:39,288 - ERROR - Exception details: Traceback (most recent call last):

  File "/app/email_archiver.py", line 160, in fetch_and_archive_emails

    recipients_parts = email.header.decode_header(email_message['To'])

  File "/usr/local/lib/python3.9/email/header.py", line 80, in decode_header

    if not ecre.search(header):

TypeError: expected string or bytes-like object

2024-03-18 14:37:39,289 - INFO - Started email archiving for account 2.

2024-03-18 14:37:39,820 - ERROR - An error occurred during email archiving for account 1: expected string or bytes-like object

2024-03-18 14:37:39,820 - ERROR - Exception details: Traceback (most recent call last):

  File "/app/email_archiver.py", line 160, in fetch_and_archive_emails

    recipients_parts = email.header.decode_header(email_message['To'])

  File "/usr/local/lib/python3.9/email/header.py", line 80, in decode_header

    if not ecre.search(header):

TypeError: expected string or bytes-like object

2024-03-18 14:37:39,820 - INFO - Started email archiving for account 2.```

ModuleNotFoundError: No module named 'flask_cors'

Getting this error on a Raspberry Pi 4:

email-archiver-web-1 | File "/app/app.py", line 8, in
email-archiver-web-1 | from flask_cors import CORS
email-archiver-web-1 | ModuleNotFoundError: No module named 'flask_cors'

Export archived mails to IMAP server

Since this app can already pull emails from a certain mailbox, it would be nice to also be able to push emails into another mailbox. This way mailboxes could be transferred from one server to another with the added bonus to make a backup of them / archiving them along the way.
Would be nice, if the export could keep folders (e.g. sent to sent, junk to junk etc.). Or even allow to custom pair folders (e.g. old-folder to new-folder).

Something similar to this application:
https://www.mailstore.com/en/products/mailstore-home/

Maybe this is out of scope for the application, but would be an amazing feature! Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.