oneyb / maildog

A friendly email assistant that reads your emails and replies to those which have a fitting ruleset, using the associated template.
1 stars 0 forks source link

Being part of a growing organization means answering alot of questions about the organization from newcomers. This can be tedious especially when the information is readily available. Many people seek a human connection via internet, so they write an email.

If many people do this the replying human may not have the time to be as informative or as friendly as one wishes. Alas, the newcomer has a sour taste from reading a short, uninformative, hastily written, or a possibly brusk reply.

Everyone likes dogs. Dogs are friendly and attuned to our emotions, habits, and lives. We train them to be helpful. This software is supposed to be like a dog that retrieves the newspaper, barks only at intruders, amiably nuzzles the newcomer, and keeps quiet when it doesn't know what to do, other than telling the owner that there is trouble. We train it to be helpful. It has the propensity to learn and grow.

Specifically it does the following.

** Install and configure it

  1. Get the software.

    +BEGIN_SRC shell

    pip3 install git+https://github.com/oneyb/maildog

    Or:

    git clone https://github.com/oneyb/maildog cd maildog && python3 setup.py install

    +END_SRC

    NOTE: you will need to install it as root or as your user (pip install --user), in order to have the following scripts in the system path.

  2. Copy the ~tests~ directory to where you want it.

    +BEGIN_SRC shell

    cp -r /usr/local/lib/python3.5/dist-packages/maildog/maildog/tests/ my_maildog/

    or

    cp -r maildog/maildog/tests/ my_maildog/

    +END_SRC

  3. Inspect and modify the following files according to your taste.

    • [[file:maildog/tests/example_app.py][maildog/tests/example_app.py]]
      • This shows a simple example of what you could set up.
    • [[file:maildog/tests/reply_data/example.pdf][maildog/tests/reply_data/example.pdf]]
      • You can add any kind of attachment.
    • [[file:maildog/tests/reply_data/beispiel.pdf][maildog/tests/reply_data/beispiel.pdf]]
      • Ditto.
    • [[file:maildog/tests/reply_templates/english.txt.j2][maildog/tests/reply_templates/english.txt.j2]]
      • What about a friendly template?
    • [[file:maildog/tests/reply_templates/german.txt.j2][maildog/tests/reply_templates/german.txt.j2]]
      • Sprechen Sie Deutsch?
    • [[file:maildog/tests/reply_rulesets/rulesets.csv][maildog/tests/reply_rulesets/rulesets.csv]] or
    • [[file:maildog/tests/reply_rulesets/rulesets.csv][maildog/tests/reply_rulesets/rulesets.xlsx]]
      • Configure what is sent (which attachment, template, etc.) and when. Don't change the filename or sheet names from their current configuration.
    • [[file:maildog/tests/config/maildog.timer][maildog/tests/config/maildog.timer]]
      • Why not cron?
    • [[file:maildog/tests/config/maildog.service][maildog/tests/config/maildog.service]]
      • Sheesh! Two files for a periodically run application?!
    • [[file:maildog/tests/config/config.py][maildog/tests/config/config.py]]
      • What you are storing passwords as plain text? You'd better have that file unreadable and that server well secured.
    • [[file:maildog/tests/test_render_template.py][maildog/tests/test_render_template.py]]
      • Ah, tests. Good.
    • [[file:maildog/tests/test_detect_language.py][maildog/tests/test_detect_language.py]]
      • Non parle italiano!? Che cazzo!
    • [[file:maildog/tests/test_email_config.py][maildog/tests/test_email_config.py]]
      • That's a cute test...
    • [[file:maildog/tests/test_ruleset.py][maildog/tests/test_ruleset.py]]
      • Those named tuples are pretty snazzy, eh?
  4. Install a systemd service for your user.

    +BEGIN_SRC shell

    cp maildog/tests/config/maildog.timer maildog/tests/config/maildog.service $HOME/.config/systemd/user/ systemctl --user enable maildog.timer

    +END_SRC

    • If you have this running on a raspberry pi, you may consider having the service run without you having to login. I mean:

      +BEGIN_SRC shell

      loginctl enable-linger $USER

      +END_SRC

  5. Check whether the dog does what you want.

  6. Enjoy the helpfulness of the new pet.

Given access to an email server, maildog fetches email and chews them into a useful form (Mail).

I have maildog working for me to reply to certain emails which generally come in two languages. You likely have an interesting case as well. Please contribute if you can. See the open issues for inspiration.