Acknowledgments: https://github.com/newroco/mail2deck
This script allows fetching emails from a mail client and save them as cards in Nextcloud Deck App, eventually assigning the card to the proper users
- Python 3.9+
- Nextcloud and Deck APP installed
- any mail
- a registered account in Nextcloud
clone the repository
git clone https://gitlab.com/christiansicari/nextcloud-mail2deck.git
move to master branch
git checkout master
install all python dependencies
pip3 install -r requirements.txt
move config.json.sample to config.json and edit with your parameters
cp config.json.sample config.json
run this script in cron
crontab -e
add this line
*/5 * * * * /usr/bin/python3 /path/to/repo/main.py
Pull the image from the Docker Hub
docker image pull christiansicari/nextcloud-mail2deck:latest
edit the config.json.sample you find in this repository
Run the docker image mapping the config.json as volume
docker run -d --name nc-mail2deck -v $PWD/config.json:/app/config.json christiansicari/nextcloud-mail2deck:latest
edit cron
crontab -e
add this line
*/5 * * * * /usr/bin/docker start nc-mail2deck
- The script reads at most 10 unseen emails per time (and mark as seen);
- For each email
- derives the board, the stack*, and the title from the subject
- derives description from body email
- try to create the card on Nextcloud
- for each attachment in the mail
- it tries to upload it in Nextcloud
- for each assignees:
- find all users ID with this email (could be more than one)
- try to assignee the card to each user_id
You can specify board and/or stack in the mail subject, using this model:
b-'theboardname's-'thestackname'Card description
Just put the assignee mail (that must be registered in Nextcloud) in the TO mail. The mail in the config file will be automatic excluded
The script will be not able to assign the card to any user if the bot user in the config is not admin or sub-admin. If you use LDAP, you need to set the mail field as a searchable field ettings -> LDAP Integration -> Advanced -> Directory Settings ->User Search Attributes
-
Provide board and card in subject
- Board and card exists → Card is stored in the provided board and card
- Board only exists
- if default stack exists in the board → the card is stored in the provided board under the default stack
- otherwise → the card is stored in the default board and stack
-
Provide only the board
- Default stack exists in the provided board → the card is stored in the required board under the default stack
- otherwise → card is stored in the default board and stack
-
Provide only the stack
- if stack exists in the default board → the card is stored in the default board under the required stack
- otherwise → the card is stored in the default board and stack