2019-11-09 13:37:52 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# mail2deck
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Provides an "email in" solution for the Nextcloud Deck app
							 
						 
					
						
							
								
									
										
										
										
											2019-11-12 11:15:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## A. For users
  
						 
					
						
							
								
									
										
										
										
											2022-01-25 09:37:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Follow the above steps to add a new card from email.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  Deck Bot is the user who will create the cards and it will be set up by your nextcloud admin. 
						 
					
						
							
								
									
										
										
										
											2022-01-25 09:52:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  In this tutorial email address for Deck Bot will be: < code > bot@ncserver.com</ code >  
						 
					
						
							
								
									
										
										
										
											2022-01-25 09:37:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### 1) Assign Deck Bot to the board.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### 2) Mail subject & content
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Let's assume you want to add a card with title "Update website logo" on board "Website" and stack "To do".
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								You can do this in two ways.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### 2.1: Set stack and board in the email subject
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Here's how the email subject should look like:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< code > Update website logo b-'Website' s-'To do'< / code >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*You can use single or double quotes.*
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### 2.2: Set the board in the email address
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								At the end of the email address prefix (before @) add "+Website"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Example: < code > bot+Website@ncserver.com< / code > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								In this case, if you don't specify the stack in the email subject, the card will be added in the first stack (if it exists).
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Note:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  Email content will be card description 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  You can add attachments in the email and those will be integrated in the created card 
						 
					
						
							
								
									
										
										
										
											2019-11-14 14:37:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## B. For NextCloud admins to setup
  
						 
					
						
							
								
									
										
										
										
											2019-12-13 18:09:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Requirements
  
						 
					
						
							
								
									
										
										
										
											2022-01-15 17:24:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								This app requires php-curl, php-mbstring ,php-imap and some sort of imap server (e.g. Postfix with Courier).
							 
						 
					
						
							
								
									
										
										
										
											2019-12-19 14:20:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### NC new user
  
						 
					
						
							
								
									
										
										
										
											2019-12-19 14:28:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Create a new user from User Management on your NC server, which will have to function as a bot. We chose to call him *deckbot* , but you can call it however you want.< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								__Note__: that you have to assign *deckbot*  on each board you want to add new cards from email.
							 
						 
					
						
							
								
									
										
										
										
											2021-12-31 00:29:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Configure Email
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### Option 1 - Set up Postfix for incoming email
  
						 
					
						
							
								
									
										
										
										
											2019-12-19 13:43:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								You can setup Posfix mail server folowing the instructions on [Posfix setup ](https://docs.gitlab.com/ee/administration/reply_by_email_postfix_setup.html ), and after that add "+" delimiter (which separe the user from the board in the email address) using the command:< br > 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-19 13:39:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								sudo postconf -e "recipient_delimiter = +"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2021-12-31 02:16:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#### Option 2 - Use an existing email server
  
						 
					
						
							
								
									
										
										
										
											2021-12-31 00:29:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								This could be any hosted email service. The only requirement is that you can connect to it via the IMAP protocol.
							 
						 
					
						
							
								
									
										
										
										
											2021-12-31 02:16:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*Please note this option may not be as flexible as a self-hosted server. For example your email service may not support the "+"delimiter for directing messages to a specific board.*
							 
						 
					
						
							
								
									
										
										
										
											2019-12-19 13:33:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Download and install
  
						 
					
						
							
								
									
										
										
										
											2021-12-31 02:16:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								If using a self-hosted Postfix server, clone this repository into the home directory of the *incoming*  user. If not self-hosting, you may need to create a new user on your system and adjust the commands in future steps to match that username.< br > 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-19 14:32:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								cd /home/incoming/
							 
						 
					
						
							
								
									
										
										
										
											2019-12-20 11:34:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								git clone https://github.com/putt1ck/mail2deck.git mail2deck
							 
						 
					
						
							
								
									
										
										
										
											2019-12-19 14:32:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2021-12-31 00:29:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Edit the config file as you need: 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-19 14:02:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								sudo nano /home/incoming/mail2deck/config.php
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2021-12-31 02:16:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*You can refer to https://www.php.net/manual/en/function.imap-open.php for setting the value of MAIL_SERVER_FLAGS*
							 
						 
					
						
							
								
									
										
										
										
											2019-12-19 14:10:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Add a cronjob which will run mail2deck.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								sudo crontab -u incoming -e
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Add the following line in the opened file:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< code > */5 * *  * *  /usr/bin/php /home/incoming/mail2deck/index.php >/dev/null 2>& 1</ code >  
						 
					
						
							
								
									
										
										
										
											2019-12-19 14:20:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Finish
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Now __mail2deck__  will add new cards every five minutes if new emails are received.