DSP2017: Development environment setup

by Marius at 21-03-2017

After a long delay in developing autocactus I manage to set up a development environment, which after the development period will become a production environment. I probably erase inbox and Mongo database to get rid of artefacts.

What was done:

  • app was installed at dedicated server and configured it to work with Github
  • special email address was created
  • Mongo database was created
  • connecting and logging with credentials
  • autocactus_settings.py was moved to autocactus.example.py as real configuration cannot be put in a code repository

After setting up development environment I sent a test email with subject ,,Test,, and body ,,this is a test body of an email:)”. Default example of imaplib returned the following content

[(b'1 (RFC822 {933}', b'Return-Path: \r\nDelivered-To:
publish@hrulabs.com100\r\nTo: publish@hrulabs.com\r\nFrom: hrulabs
\r\nSubject: Test\r\nMessage-ID:
<361a7017-806e-1fe2-3862-6367ddcbb050@hrulabs.com>\r\nDate: Mon, 20 Mar 2017
21:04:08 +0100\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0)
Gecko/20100101\r\n Thunderbird/45.8.0\r\nMIME-Version: 1.0\r\nContent-Type:
text/plain; charset=utf-8\r\nContent-Transfer-Encoding:
7bit\r\nX-Authenticated-User: hrulabs@hrulabs.com\r\n\r\nthis is a test body of
an email:)\r\n\r\n'), b')']

It was not exactly what I expected. After applying some tips thanks to http://stackoverflow.com/questions/2230037/how-to-fetch-an-email-body-using-imaplib-in-python

To: publish@hrulabs.com
From: hrulabs 
Subject: Test
Message-ID: <361a7017-806e-1fe2-3862-6367ddcbb050@hrulabs.com>
Date: Mon, 20 Mar 2017 21:04:08 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Authenticated-User: hrulabs@hrulabs.com

this is a test body of an email:)

My notes are rather short, but I think they will get longer and longer as it would become for me easier and easier to write more in English.