2023-05-30T17:15:00,460 Created temporary directory: /tmp/pip-build-tracker-xigxwp1v 2023-05-30T17:15:00,463 Initialized build tracking at /tmp/pip-build-tracker-xigxwp1v 2023-05-30T17:15:00,463 Created build tracker: /tmp/pip-build-tracker-xigxwp1v 2023-05-30T17:15:00,464 Entered build tracker: /tmp/pip-build-tracker-xigxwp1v 2023-05-30T17:15:00,465 Created temporary directory: /tmp/pip-wheel-k78wrrcp 2023-05-30T17:15:00,474 Created temporary directory: /tmp/pip-ephem-wheel-cache-xiulzkwm 2023-05-30T17:15:00,525 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple 2023-05-30T17:15:00,533 2 location(s) to search for versions of mbox2m365: 2023-05-30T17:15:00,533 * https://pypi.org/simple/mbox2m365/ 2023-05-30T17:15:00,533 * https://www.piwheels.org/simple/mbox2m365/ 2023-05-30T17:15:00,535 Fetching project page and analyzing links: https://pypi.org/simple/mbox2m365/ 2023-05-30T17:15:00,536 Getting page https://pypi.org/simple/mbox2m365/ 2023-05-30T17:15:00,539 Found index url https://pypi.org/simple/ 2023-05-30T17:15:00,725 Fetched page https://pypi.org/simple/mbox2m365/ as application/vnd.pypi.simple.v1+json 2023-05-30T17:15:00,729 Found link https://files.pythonhosted.org/packages/6c/31/171401930c8923f943a1ea671a726209113bdb0759b36af9716eb61eaa12/mbox2m365-3.0.6.tar.gz (from https://pypi.org/simple/mbox2m365/), version: 3.0.6 2023-05-30T17:15:00,730 Found link https://files.pythonhosted.org/packages/93/dd/07f5465ee90fb81b7f6df237ecb0abefefecf0c984adef70730493503804/mbox2m365-3.0.8.tar.gz (from https://pypi.org/simple/mbox2m365/), version: 3.0.8 2023-05-30T17:15:00,731 Found link https://files.pythonhosted.org/packages/7f/96/ebd03ef2d3be45b7fcdcbf603cfe23fcbd4db15135dd4d9a1dd7b389281e/mbox2m365-3.0.10.tar.gz (from https://pypi.org/simple/mbox2m365/), version: 3.0.10 2023-05-30T17:15:00,732 Found link https://files.pythonhosted.org/packages/4d/6a/5547755d2f0ffd2898dfea194692fa316f3ae928e023c53e68180ba014d0/mbox2m365-3.0.12.tar.gz (from https://pypi.org/simple/mbox2m365/), version: 3.0.12 2023-05-30T17:15:00,732 Found link https://files.pythonhosted.org/packages/24/48/5765400ed318e16ce6a1f901a7e1e39efe14da6f6e16baba3bc7970f5be4/mbox2m365-3.0.14.tar.gz (from https://pypi.org/simple/mbox2m365/), version: 3.0.14 2023-05-30T17:15:00,733 Found link https://files.pythonhosted.org/packages/65/c6/9490d087c5f5c65e12e7a9c483c2fe53ac3d9a6cb1491d4295908f889867/mbox2m365-3.0.16.tar.gz (from https://pypi.org/simple/mbox2m365/), version: 3.0.16 2023-05-30T17:15:00,734 Fetching project page and analyzing links: https://www.piwheels.org/simple/mbox2m365/ 2023-05-30T17:15:00,735 Getting page https://www.piwheels.org/simple/mbox2m365/ 2023-05-30T17:15:00,737 Found index url https://www.piwheels.org/simple/ 2023-05-30T17:15:00,974 Fetched page https://www.piwheels.org/simple/mbox2m365/ as text/html 2023-05-30T17:15:00,978 Skipping link: No binaries permitted for mbox2m365: https://www.piwheels.org/simple/mbox2m365/mbox2m365-3.0.14-py3-none-any.whl#sha256=63fec01e1f79300cc926e7d89e60e23181f7209ee44f7f69d109591b67548b0e (from https://www.piwheels.org/simple/mbox2m365/) 2023-05-30T17:15:00,978 Skipping link: No binaries permitted for mbox2m365: https://www.piwheels.org/simple/mbox2m365/mbox2m365-3.0.12-py3-none-any.whl#sha256=11f16b89a6d1dd91415a578920301907c064002e897d0bf22ded4af66a001441 (from https://www.piwheels.org/simple/mbox2m365/) 2023-05-30T17:15:00,979 Skipping link: not a file: https://www.piwheels.org/simple/mbox2m365/ 2023-05-30T17:15:00,979 Skipping link: not a file: https://pypi.org/simple/mbox2m365/ 2023-05-30T17:15:01,014 Given no hashes to check 1 links for project 'mbox2m365': discarding no candidates 2023-05-30T17:15:01,045 Collecting mbox2m365==3.0.16 2023-05-30T17:15:01,049 Created temporary directory: /tmp/pip-unpack-ksv8m62d 2023-05-30T17:15:01,225 Downloading mbox2m365-3.0.16.tar.gz (22 kB) 2023-05-30T17:15:01,341 Added mbox2m365==3.0.16 from https://files.pythonhosted.org/packages/65/c6/9490d087c5f5c65e12e7a9c483c2fe53ac3d9a6cb1491d4295908f889867/mbox2m365-3.0.16.tar.gz to build tracker '/tmp/pip-build-tracker-xigxwp1v' 2023-05-30T17:15:01,354 Created temporary directory: /tmp/pip-build-env-c_wzz7rc 2023-05-30T17:15:01,374 Installing build dependencies: started 2023-05-30T17:15:01,376 Running command pip subprocess to install build dependencies 2023-05-30T17:15:04,059 Using pip 23.1.2 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7) 2023-05-30T17:15:04,792 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple 2023-05-30T17:15:08,773 Collecting setuptools>=42 2023-05-30T17:15:09,020 Using cached https://www.piwheels.org/simple/setuptools/setuptools-67.8.0-py3-none-any.whl (1.1 MB) 2023-05-30T17:15:09,679 Collecting wheel 2023-05-30T17:15:09,720 Using cached https://www.piwheels.org/simple/wheel/wheel-0.40.0-py3-none-any.whl (64 kB) 2023-05-30T17:15:14,045 Installing collected packages: wheel, setuptools 2023-05-30T17:15:14,497 Creating /tmp/pip-build-env-c_wzz7rc/overlay/bin 2023-05-30T17:15:14,502 changing mode of /tmp/pip-build-env-c_wzz7rc/overlay/bin/wheel to 755 2023-05-30T17:15:18,769 Successfully installed setuptools-67.8.0 wheel-0.40.0 2023-05-30T17:15:19,220 Installing build dependencies: finished with status 'done' 2023-05-30T17:15:19,232 Getting requirements to build wheel: started 2023-05-30T17:15:19,234 Running command Getting requirements to build wheel 2023-05-30T17:15:20,656 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `description` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:20,657 !! 2023-05-30T17:15:20,658 ******************************************************************************** 2023-05-30T17:15:20,658 ########################################################################## 2023-05-30T17:15:20,659 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:20,659 ########################################################################## 2023-05-30T17:15:20,660 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:20,661 `description = "'Send a message stored within an mbox using m365 (Office365)'"` 2023-05-30T17:15:20,661 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:20,662 consider this value unless `description` is listed as `dynamic`. 2023-05-30T17:15:20,662 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:20,663 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:20,663 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:20,664 follow strictly the standard. 2023-05-30T17:15:20,664 To prevent this warning, you can list `description` under `dynamic` or alternatively 2023-05-30T17:15:20,664 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:20,665 configuration. 2023-05-30T17:15:20,665 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:20,666 or your builds will no longer be supported. 2023-05-30T17:15:20,666 ******************************************************************************** 2023-05-30T17:15:20,667 !! 2023-05-30T17:15:20,667 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:20,667 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `readme` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:20,668 !! 2023-05-30T17:15:20,668 ******************************************************************************** 2023-05-30T17:15:20,669 ########################################################################## 2023-05-30T17:15:20,669 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:20,669 ########################################################################## 2023-05-30T17:15:20,670 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:20,671 `readme = '# Abstract\n\nThis repository contains a simple python script that (1) processes an\n`mbox` style mailbox file, (2) parses out (typically) the last message\nand then (3) re-transmits this using the CLI `m365` toolset. While this\nscript can be used in a completely stand-alone manner to extract a\nmessage from an `mbox` and then *send* using `m365`, it’s main utility\nis when used in a full ecosystem including an email client and `postfix`\nserver.\n\nThe CLI `m365` offers the ability to use Outlook/Office365 to send\nemails. However, this tool is not suited to use as a mail client\u2009—\u2009it\nmerely offers a means to transmit a message from the command line. More\nuseful would be if existing mail clients could leverage `m365` natively.\nCurrently, however, this is not available. Therefore, `mbox2m365` was\ncreated to complete a "missing link" in a full email experience. Using\nthis tool in a configured environment, it is now possible to use *any*\nemail client to transmit messages using Outlook/Office365.\n\n# TL;DR\n\nEven if you’re impatient, it’s a good idea to read this document.\nHowever, assuming you’ve already built the infrastructure, assuming you\nhave installed `m365` (and logged into your Institution from `m365`),\nhave assuming you have setup your email client to email to a dummy local\npostfix account, then you can install `mbox2m365` with a simple\n\n``` bash\npip install mbox2m365\n```\n\nnote at time of writing the PyPI install might not be available. In that\ncase, simply clone this repo and do a\n\n``` bash\n# From the repo root dir\npip install -U .\n```\n\nand fire it off by setting up the monitor on the `mbox` file (here we\nassume the mbox belongs to `rudolph`)\n\n``` bash\ncd /var/mail\nfind . | entr mbox2m365 --mbox rudolph --b64_encode \\\n --sendFromFile --cleanUp \\\n --waitForStragglers 5\n```\n\n(Clearly the above relies on [`entr`](https://github.com/eradman/entr).\nConsult your distro’s repos for the appropriate install. In arch, this\nis `yay -S entr`, in Ubuntu, this is `sudo apt install entr`)\n\n# Security alert!\n\nWait! **Danger, Will Robinson**! Doesn’t this violate security policies?\nI was told my Institution does *not* allow clients like thunderbird to\nconnect to the Outlook server to send emails!\n\nWell, the devil is in the details as the saying goes. This solution does\n*not* violate policy since the "unauthenticated" email client is *not*\never connecting/authenticating to the Outlook server. Rather, the\n"unauthenticated" email client sends messages to a specially configured\nserver that "saves" the emails to a file. Then, a separate program\nteases out the new arrivals and uses the **authenticated** `m365`\nprogram to actually talk to and leverage Outlook to send the email. This\n*separate program* that bridges the mail file to `m365` is none other\nthan this python module.\n\nSo to be pendantic: all credentialing and authentication is handled by\n`m365` and *not* this tool. The end user is still required to\nlogin/authenticate using `m365`. If this has not happened, then\n`mbox2m365` will not work.\n\nAgain, this repo contains **no** authentication tokens/passwords/etc.\n\n# Limitations\n\nLet’s get these out of the way first. This is *not* a full solution for\nlinking a third party email client to Outlook. It gets *close*, IMHO.\nThe limitations are:\n\n- This is not a multi-user solution. All email transmitted to the\n intermediate helper server is added to a single user `mbox` which when\n processed by this script means **all** email in that `mbox` will\n appear to have been transmitted by that user. While in theory it\n should be possible to support multiple users, either by having a\n separate helper server per user or by having multiple local users on\n the mail server and separate `mbox` files, the current solution is\n clearly not scalable. It is decent though for the single user case.\n\n- Fundmanentally, this solution is limited first and foremost by the\n capabilities of the CLI `m365 outlook mail send` functionality. Recent\n updates to `m365` have expanded functionality of this bridge\u2009—\u2009most\n notably attachments are now supported. Still pending is full `bcc`\n support\u2009—\u2009currently all `bcc` recipients are switched to `cc`.\n\nOther limitations stem from the fact the bridge needs to process the\n`mbox` file *de novo* each time mail is received by the helper server.\nThis means that time to process will increase linearly with `mbox` size.\nThe real world implications of this are still being explored.\n\nFinally, the bridge does make a best effort attempt to *wait* until the\n`mbox` has stabilized before analyzing it. When sending emails to\nmultiple recipients, *each* recipient gets a single complete copy in the\n`mbox` with a single address (the multiple recipient addresses are not\nconserved in the `mbox` but *are* processed by this bridge). While\narguably wasteful, the implication is that while all these recipient\ncopies are appended to the `mbox`, the bridge should wait until all have\nbeen added before processing. Currently the bridge attempts this by\nexamining the `mbox` file size when called, and waiting a small delta\ntime interval and checking if the size has changed again. It will wait\nuntil the size is stable before continuing. The TL;DR is this could\nresult in a processing delay.\n\n# Introduction\n\nThe migration/adoption of Office365 by institutions often poses issues\nand problems for users wishing to use different tools for email\ntransmission, particularly on platforms such as Linux.\n\nWhile it is possible to access various Office365 applications,\nparticularly Outlook, via a web interface, this is often not sufficient\nfor several classes of users, particularly those who find the web\ninterface cumbersome (for instance, the web interface has no (or\nlimited) support for keyboard shortcuts, it is cumbersome if not\nimpossible to automate tasks involving event-driven email) and/or for\nusers who have an existing and efficient email workflow using clients\nsuch as `thunderbird` or `mutt`.\n\nThis small repo houses a small and simple python application with some\nsupporting documentation that provides a solution to the problem of\nsending email from an instituion’s managed domain by leveraging\n`postfix` and some `mbox` processing and then using the CLI tool `m365`.\n\n# Method Summary\n\nThe solution requires some seemingly contortuous steps, but in reality\nis rather simple and can be summarized as follows:\n\n## Reading email\n\nReading emails that are locked away in an Outlook server is best\neffected by simply adding a forward incoming email rule from your\nInstitution Outlook Server (IOS) to an externally accessible email\nprovider (such as `gmail`), allowing this email to be read easily by\ntools such as `thunderbird` or `mutt`.\n\n ┌─────────────────────────────────┐\n │IOS that receives incoming email │\n └┬────────────────────────────────┘\n │\n └─────┐\n │\n ┌O─────────────────────┐\n │forwardRule()│\n └┬─────────────────────┘\n ┌─────┘\n │\n ┌O────┐\n │gmail│\n └┬────┘\n └─────┐\n │\n ┌O──────────────────────┐\n │clientAccess()│\n └O──────────────────────┘\n ┌─────┘\n │\n ┌┴───────────────────────┐\n │thunderbird / mutt / etc│\n └────────────────────────┘\n\n## Sending email\n\nThe message is now outside of Outlook, and if the Institution does not\nallow non-authorized clients (often this means they only allow Microsoft\ntools) to connect to the Outlook server, the following work around will\nhelp. Essentially, the outside client should be configured to send email\nusing a properly setup `postfix` server that simply copies the target\nemail to an `mbox` file.\n\nThis `mbox` file is then monitored for any changes, and on a change\n(assumed to mean a new email message has been appended), a new process\nis fired off to parse off the latest message and then use the command\nline `m365` CLI tool to have the IOS send the email.\n\n ┌───────────────────────┐\n │thundebird / mutt /etc │\n └┬──────────────────────┘\n │\n └─────┐\n │\n ┌O────────────────────────────┐\n │sendmail() (postfix)│\n └┬────────────────────────────┘\n ┌─────┘\n │\n ┌O────┐\n │mbox │\n └┬────┘\n └─────┐\n │\n ┌O────────┐\n │mbox2m365│ <--- this repo!\n └┬────────┘\n ┌─────┘\n │\n ┌O─────────────┐\n │m365 │\n └┬─────────────┘\n │\n ┌O────────────────────────────────┐\n │IOS that transmits outgoing email│\n └─────────────────────────────────┘\n\n# `mbox2m365`\n\nWhile all the building blocks to effect the solution exist, the one\nmissing piece is the `mbox` to `m365` block, which is provided for by\nthis rather simple python script.\n\n# Setup your helper mail server, `postfix`\n\nFirst, install `postfix`\n\n## Arch\n\n``` bash\nyay -S postfix\n```\n\n## Ubuntu\n\n``` bash\nsudo apt install postfix\n```\n\n# `transport`\n\nNow, edit the `transport` file.\n\n``` bash\nsudo bash\ncd /etc/postfix\ncp transport transport.orig\necho "* local:rudolph" >> transport\n```\n\n# `main.cf`\n\nFor the `main.cf` file, do\n\n``` bash\n# Assuming you are still in the /etc/postfix dir in a sudo bash shell...\ncp main.cf main.cf.orig\necho "mydomain = pangea.net" >> main.cf\necho "luser_relay = rudolph@pangea.net"\necho "transport_maps = hash:/etc/postfix/transport" >> main.cf\n```\n\n# enable/restart the services\n\n``` bash\nsudo systemctl enable postfix.service\nsudo systemctl restart postfix.service\n```\n\n# Email client\n\nSimply configure your email client to use the machine running `postfix`\nas your email server. All emails will be appended to the `transport`\nuser’s `mbox` file.\n\n# Fire up `mbox2m365`\n\nThe final piece of the puzzle:\n\n``` bash\ncd /var/mail\nfind . | entr mbox2m365 --mbox rudolph --b64_encode \\\n --sendFromFile --cleanUp \\\n --waitForStragglers 5\n```\n\n*-30-*\n'` 2023-05-30T17:15:20,673 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:20,673 consider this value unless `readme` is listed as `dynamic`. 2023-05-30T17:15:20,674 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:20,674 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:20,675 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:20,675 follow strictly the standard. 2023-05-30T17:15:20,676 To prevent this warning, you can list `readme` under `dynamic` or alternatively 2023-05-30T17:15:20,676 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:20,676 configuration. 2023-05-30T17:15:20,677 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:20,677 or your builds will no longer be supported. 2023-05-30T17:15:20,678 ******************************************************************************** 2023-05-30T17:15:20,678 !! 2023-05-30T17:15:20,679 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:21,332 running egg_info 2023-05-30T17:15:21,343 writing mbox2m365.egg-info/PKG-INFO 2023-05-30T17:15:21,347 writing dependency_links to mbox2m365.egg-info/dependency_links.txt 2023-05-30T17:15:21,352 writing entry points to mbox2m365.egg-info/entry_points.txt 2023-05-30T17:15:21,355 writing requirements to mbox2m365.egg-info/requires.txt 2023-05-30T17:15:21,357 writing top-level names to mbox2m365.egg-info/top_level.txt 2023-05-30T17:15:21,394 reading manifest file 'mbox2m365.egg-info/SOURCES.txt' 2023-05-30T17:15:21,399 reading manifest template 'MANIFEST.in' 2023-05-30T17:15:21,401 adding license file 'LICENSE' 2023-05-30T17:15:21,406 writing manifest file 'mbox2m365.egg-info/SOURCES.txt' 2023-05-30T17:15:21,410 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `license` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:21,411 !! 2023-05-30T17:15:21,412 ******************************************************************************** 2023-05-30T17:15:21,412 ########################################################################## 2023-05-30T17:15:21,413 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:21,413 ########################################################################## 2023-05-30T17:15:21,414 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:21,415 `license = 'MIT'` 2023-05-30T17:15:21,416 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:21,416 consider this value unless `license` is listed as `dynamic`. 2023-05-30T17:15:21,417 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:21,418 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:21,419 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:21,419 follow strictly the standard. 2023-05-30T17:15:21,420 To prevent this warning, you can list `license` under `dynamic` or alternatively 2023-05-30T17:15:21,420 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:21,421 configuration. 2023-05-30T17:15:21,422 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:21,422 or your builds will no longer be supported. 2023-05-30T17:15:21,423 ******************************************************************************** 2023-05-30T17:15:21,424 !! 2023-05-30T17:15:21,424 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:21,425 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `authors` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:21,425 !! 2023-05-30T17:15:21,426 ******************************************************************************** 2023-05-30T17:15:21,427 ########################################################################## 2023-05-30T17:15:21,427 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:21,427 ########################################################################## 2023-05-30T17:15:21,428 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:21,429 `authors = 'Rudolph Pienaar'` 2023-05-30T17:15:21,430 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:21,430 consider this value unless `authors` is listed as `dynamic`. 2023-05-30T17:15:21,431 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:21,432 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:21,432 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:21,433 follow strictly the standard. 2023-05-30T17:15:21,433 To prevent this warning, you can list `authors` under `dynamic` or alternatively 2023-05-30T17:15:21,434 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:21,434 configuration. 2023-05-30T17:15:21,435 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:21,435 or your builds will no longer be supported. 2023-05-30T17:15:21,436 ******************************************************************************** 2023-05-30T17:15:21,437 !! 2023-05-30T17:15:21,437 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:21,588 Getting requirements to build wheel: finished with status 'done' 2023-05-30T17:15:21,608 Created temporary directory: /tmp/pip-modern-metadata-6dnxksdh 2023-05-30T17:15:21,613 Preparing metadata (pyproject.toml): started 2023-05-30T17:15:21,616 Running command Preparing metadata (pyproject.toml) 2023-05-30T17:15:22,879 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `description` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:22,880 !! 2023-05-30T17:15:22,881 ******************************************************************************** 2023-05-30T17:15:22,882 ########################################################################## 2023-05-30T17:15:22,882 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:22,882 ########################################################################## 2023-05-30T17:15:22,883 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:22,884 `description = "'Send a message stored within an mbox using m365 (Office365)'"` 2023-05-30T17:15:22,884 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:22,885 consider this value unless `description` is listed as `dynamic`. 2023-05-30T17:15:22,885 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:22,886 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:22,886 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:22,886 follow strictly the standard. 2023-05-30T17:15:22,887 To prevent this warning, you can list `description` under `dynamic` or alternatively 2023-05-30T17:15:22,887 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:22,888 configuration. 2023-05-30T17:15:22,888 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:22,889 or your builds will no longer be supported. 2023-05-30T17:15:22,889 ******************************************************************************** 2023-05-30T17:15:22,889 !! 2023-05-30T17:15:22,890 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:22,890 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `readme` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:22,891 !! 2023-05-30T17:15:22,891 ******************************************************************************** 2023-05-30T17:15:22,892 ########################################################################## 2023-05-30T17:15:22,892 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:22,892 ########################################################################## 2023-05-30T17:15:22,893 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:22,894 `readme = '# Abstract\n\nThis repository contains a simple python script that (1) processes an\n`mbox` style mailbox file, (2) parses out (typically) the last message\nand then (3) re-transmits this using the CLI `m365` toolset. While this\nscript can be used in a completely stand-alone manner to extract a\nmessage from an `mbox` and then *send* using `m365`, it’s main utility\nis when used in a full ecosystem including an email client and `postfix`\nserver.\n\nThe CLI `m365` offers the ability to use Outlook/Office365 to send\nemails. However, this tool is not suited to use as a mail client\u2009—\u2009it\nmerely offers a means to transmit a message from the command line. More\nuseful would be if existing mail clients could leverage `m365` natively.\nCurrently, however, this is not available. Therefore, `mbox2m365` was\ncreated to complete a "missing link" in a full email experience. Using\nthis tool in a configured environment, it is now possible to use *any*\nemail client to transmit messages using Outlook/Office365.\n\n# TL;DR\n\nEven if you’re impatient, it’s a good idea to read this document.\nHowever, assuming you’ve already built the infrastructure, assuming you\nhave installed `m365` (and logged into your Institution from `m365`),\nhave assuming you have setup your email client to email to a dummy local\npostfix account, then you can install `mbox2m365` with a simple\n\n``` bash\npip install mbox2m365\n```\n\nnote at time of writing the PyPI install might not be available. In that\ncase, simply clone this repo and do a\n\n``` bash\n# From the repo root dir\npip install -U .\n```\n\nand fire it off by setting up the monitor on the `mbox` file (here we\nassume the mbox belongs to `rudolph`)\n\n``` bash\ncd /var/mail\nfind . | entr mbox2m365 --mbox rudolph --b64_encode \\\n --sendFromFile --cleanUp \\\n --waitForStragglers 5\n```\n\n(Clearly the above relies on [`entr`](https://github.com/eradman/entr).\nConsult your distro’s repos for the appropriate install. In arch, this\nis `yay -S entr`, in Ubuntu, this is `sudo apt install entr`)\n\n# Security alert!\n\nWait! **Danger, Will Robinson**! Doesn’t this violate security policies?\nI was told my Institution does *not* allow clients like thunderbird to\nconnect to the Outlook server to send emails!\n\nWell, the devil is in the details as the saying goes. This solution does\n*not* violate policy since the "unauthenticated" email client is *not*\never connecting/authenticating to the Outlook server. Rather, the\n"unauthenticated" email client sends messages to a specially configured\nserver that "saves" the emails to a file. Then, a separate program\nteases out the new arrivals and uses the **authenticated** `m365`\nprogram to actually talk to and leverage Outlook to send the email. This\n*separate program* that bridges the mail file to `m365` is none other\nthan this python module.\n\nSo to be pendantic: all credentialing and authentication is handled by\n`m365` and *not* this tool. The end user is still required to\nlogin/authenticate using `m365`. If this has not happened, then\n`mbox2m365` will not work.\n\nAgain, this repo contains **no** authentication tokens/passwords/etc.\n\n# Limitations\n\nLet’s get these out of the way first. This is *not* a full solution for\nlinking a third party email client to Outlook. It gets *close*, IMHO.\nThe limitations are:\n\n- This is not a multi-user solution. All email transmitted to the\n intermediate helper server is added to a single user `mbox` which when\n processed by this script means **all** email in that `mbox` will\n appear to have been transmitted by that user. While in theory it\n should be possible to support multiple users, either by having a\n separate helper server per user or by having multiple local users on\n the mail server and separate `mbox` files, the current solution is\n clearly not scalable. It is decent though for the single user case.\n\n- Fundmanentally, this solution is limited first and foremost by the\n capabilities of the CLI `m365 outlook mail send` functionality. Recent\n updates to `m365` have expanded functionality of this bridge\u2009—\u2009most\n notably attachments are now supported. Still pending is full `bcc`\n support\u2009—\u2009currently all `bcc` recipients are switched to `cc`.\n\nOther limitations stem from the fact the bridge needs to process the\n`mbox` file *de novo* each time mail is received by the helper server.\nThis means that time to process will increase linearly with `mbox` size.\nThe real world implications of this are still being explored.\n\nFinally, the bridge does make a best effort attempt to *wait* until the\n`mbox` has stabilized before analyzing it. When sending emails to\nmultiple recipients, *each* recipient gets a single complete copy in the\n`mbox` with a single address (the multiple recipient addresses are not\nconserved in the `mbox` but *are* processed by this bridge). While\narguably wasteful, the implication is that while all these recipient\ncopies are appended to the `mbox`, the bridge should wait until all have\nbeen added before processing. Currently the bridge attempts this by\nexamining the `mbox` file size when called, and waiting a small delta\ntime interval and checking if the size has changed again. It will wait\nuntil the size is stable before continuing. The TL;DR is this could\nresult in a processing delay.\n\n# Introduction\n\nThe migration/adoption of Office365 by institutions often poses issues\nand problems for users wishing to use different tools for email\ntransmission, particularly on platforms such as Linux.\n\nWhile it is possible to access various Office365 applications,\nparticularly Outlook, via a web interface, this is often not sufficient\nfor several classes of users, particularly those who find the web\ninterface cumbersome (for instance, the web interface has no (or\nlimited) support for keyboard shortcuts, it is cumbersome if not\nimpossible to automate tasks involving event-driven email) and/or for\nusers who have an existing and efficient email workflow using clients\nsuch as `thunderbird` or `mutt`.\n\nThis small repo houses a small and simple python application with some\nsupporting documentation that provides a solution to the problem of\nsending email from an instituion’s managed domain by leveraging\n`postfix` and some `mbox` processing and then using the CLI tool `m365`.\n\n# Method Summary\n\nThe solution requires some seemingly contortuous steps, but in reality\nis rather simple and can be summarized as follows:\n\n## Reading email\n\nReading emails that are locked away in an Outlook server is best\neffected by simply adding a forward incoming email rule from your\nInstitution Outlook Server (IOS) to an externally accessible email\nprovider (such as `gmail`), allowing this email to be read easily by\ntools such as `thunderbird` or `mutt`.\n\n ┌─────────────────────────────────┐\n │IOS that receives incoming email │\n └┬────────────────────────────────┘\n │\n └─────┐\n │\n ┌O─────────────────────┐\n │forwardRule()│\n └┬─────────────────────┘\n ┌─────┘\n │\n ┌O────┐\n │gmail│\n └┬────┘\n └─────┐\n │\n ┌O──────────────────────┐\n │clientAccess()│\n └O──────────────────────┘\n ┌─────┘\n │\n ┌┴───────────────────────┐\n │thunderbird / mutt / etc│\n └────────────────────────┘\n\n## Sending email\n\nThe message is now outside of Outlook, and if the Institution does not\nallow non-authorized clients (often this means they only allow Microsoft\ntools) to connect to the Outlook server, the following work around will\nhelp. Essentially, the outside client should be configured to send email\nusing a properly setup `postfix` server that simply copies the target\nemail to an `mbox` file.\n\nThis `mbox` file is then monitored for any changes, and on a change\n(assumed to mean a new email message has been appended), a new process\nis fired off to parse off the latest message and then use the command\nline `m365` CLI tool to have the IOS send the email.\n\n ┌───────────────────────┐\n │thundebird / mutt /etc │\n └┬──────────────────────┘\n │\n └─────┐\n │\n ┌O────────────────────────────┐\n │sendmail() (postfix)│\n └┬────────────────────────────┘\n ┌─────┘\n │\n ┌O────┐\n │mbox │\n └┬────┘\n └─────┐\n │\n ┌O────────┐\n │mbox2m365│ <--- this repo!\n └┬────────┘\n ┌─────┘\n │\n ┌O─────────────┐\n │m365 │\n └┬─────────────┘\n │\n ┌O────────────────────────────────┐\n │IOS that transmits outgoing email│\n └─────────────────────────────────┘\n\n# `mbox2m365`\n\nWhile all the building blocks to effect the solution exist, the one\nmissing piece is the `mbox` to `m365` block, which is provided for by\nthis rather simple python script.\n\n# Setup your helper mail server, `postfix`\n\nFirst, install `postfix`\n\n## Arch\n\n``` bash\nyay -S postfix\n```\n\n## Ubuntu\n\n``` bash\nsudo apt install postfix\n```\n\n# `transport`\n\nNow, edit the `transport` file.\n\n``` bash\nsudo bash\ncd /etc/postfix\ncp transport transport.orig\necho "* local:rudolph" >> transport\n```\n\n# `main.cf`\n\nFor the `main.cf` file, do\n\n``` bash\n# Assuming you are still in the /etc/postfix dir in a sudo bash shell...\ncp main.cf main.cf.orig\necho "mydomain = pangea.net" >> main.cf\necho "luser_relay = rudolph@pangea.net"\necho "transport_maps = hash:/etc/postfix/transport" >> main.cf\n```\n\n# enable/restart the services\n\n``` bash\nsudo systemctl enable postfix.service\nsudo systemctl restart postfix.service\n```\n\n# Email client\n\nSimply configure your email client to use the machine running `postfix`\nas your email server. All emails will be appended to the `transport`\nuser’s `mbox` file.\n\n# Fire up `mbox2m365`\n\nThe final piece of the puzzle:\n\n``` bash\ncd /var/mail\nfind . | entr mbox2m365 --mbox rudolph --b64_encode \\\n --sendFromFile --cleanUp \\\n --waitForStragglers 5\n```\n\n*-30-*\n'` 2023-05-30T17:15:22,895 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:22,896 consider this value unless `readme` is listed as `dynamic`. 2023-05-30T17:15:22,896 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:22,897 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:22,897 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:22,898 follow strictly the standard. 2023-05-30T17:15:22,898 To prevent this warning, you can list `readme` under `dynamic` or alternatively 2023-05-30T17:15:22,899 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:22,899 configuration. 2023-05-30T17:15:22,900 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:22,900 or your builds will no longer be supported. 2023-05-30T17:15:22,900 ******************************************************************************** 2023-05-30T17:15:22,901 !! 2023-05-30T17:15:22,901 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:23,522 running dist_info 2023-05-30T17:15:23,539 creating /tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info 2023-05-30T17:15:23,549 writing /tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info/PKG-INFO 2023-05-30T17:15:23,554 writing dependency_links to /tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info/dependency_links.txt 2023-05-30T17:15:23,558 writing entry points to /tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info/entry_points.txt 2023-05-30T17:15:23,561 writing requirements to /tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info/requires.txt 2023-05-30T17:15:23,563 writing top-level names to /tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info/top_level.txt 2023-05-30T17:15:23,566 writing manifest file '/tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info/SOURCES.txt' 2023-05-30T17:15:23,598 reading manifest file '/tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info/SOURCES.txt' 2023-05-30T17:15:23,603 reading manifest template 'MANIFEST.in' 2023-05-30T17:15:23,605 adding license file 'LICENSE' 2023-05-30T17:15:23,610 writing manifest file '/tmp/pip-modern-metadata-6dnxksdh/mbox2m365.egg-info/SOURCES.txt' 2023-05-30T17:15:23,612 creating '/tmp/pip-modern-metadata-6dnxksdh/mbox2m365-3.0.16.dist-info' 2023-05-30T17:15:23,691 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `license` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:23,692 !! 2023-05-30T17:15:23,693 ******************************************************************************** 2023-05-30T17:15:23,693 ########################################################################## 2023-05-30T17:15:23,694 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:23,694 ########################################################################## 2023-05-30T17:15:23,695 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:23,696 `license = 'MIT'` 2023-05-30T17:15:23,697 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:23,697 consider this value unless `license` is listed as `dynamic`. 2023-05-30T17:15:23,698 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:23,699 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:23,700 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:23,700 follow strictly the standard. 2023-05-30T17:15:23,701 To prevent this warning, you can list `license` under `dynamic` or alternatively 2023-05-30T17:15:23,702 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:23,702 configuration. 2023-05-30T17:15:23,703 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:23,704 or your builds will no longer be supported. 2023-05-30T17:15:23,704 ******************************************************************************** 2023-05-30T17:15:23,705 !! 2023-05-30T17:15:23,706 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:23,706 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `authors` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:23,707 !! 2023-05-30T17:15:23,707 ******************************************************************************** 2023-05-30T17:15:23,708 ########################################################################## 2023-05-30T17:15:23,708 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:23,709 ########################################################################## 2023-05-30T17:15:23,709 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:23,710 `authors = 'Rudolph Pienaar'` 2023-05-30T17:15:23,711 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:23,711 consider this value unless `authors` is listed as `dynamic`. 2023-05-30T17:15:23,712 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:23,713 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:23,713 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:23,714 follow strictly the standard. 2023-05-30T17:15:23,715 To prevent this warning, you can list `authors` under `dynamic` or alternatively 2023-05-30T17:15:23,715 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:23,716 configuration. 2023-05-30T17:15:23,716 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:23,717 or your builds will no longer be supported. 2023-05-30T17:15:23,717 ******************************************************************************** 2023-05-30T17:15:23,718 !! 2023-05-30T17:15:23,718 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:23,870 Preparing metadata (pyproject.toml): finished with status 'done' 2023-05-30T17:15:23,887 Source in /tmp/pip-wheel-k78wrrcp/mbox2m365_6f127d5587f64aaca4adffdf290b28c2 has version 3.0.16, which satisfies requirement mbox2m365==3.0.16 from https://files.pythonhosted.org/packages/65/c6/9490d087c5f5c65e12e7a9c483c2fe53ac3d9a6cb1491d4295908f889867/mbox2m365-3.0.16.tar.gz 2023-05-30T17:15:23,889 Removed mbox2m365==3.0.16 from https://files.pythonhosted.org/packages/65/c6/9490d087c5f5c65e12e7a9c483c2fe53ac3d9a6cb1491d4295908f889867/mbox2m365-3.0.16.tar.gz from build tracker '/tmp/pip-build-tracker-xigxwp1v' 2023-05-30T17:15:23,900 Created temporary directory: /tmp/pip-unpack-3sa7_sab 2023-05-30T17:15:23,902 Building wheels for collected packages: mbox2m365 2023-05-30T17:15:23,912 Created temporary directory: /tmp/pip-wheel-4cbznw8g 2023-05-30T17:15:23,913 Destination directory: /tmp/pip-wheel-4cbznw8g 2023-05-30T17:15:23,918 Building wheel for mbox2m365 (pyproject.toml): started 2023-05-30T17:15:23,920 Running command Building wheel for mbox2m365 (pyproject.toml) 2023-05-30T17:15:25,166 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `description` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:25,167 !! 2023-05-30T17:15:25,168 ******************************************************************************** 2023-05-30T17:15:25,168 ########################################################################## 2023-05-30T17:15:25,169 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:25,169 ########################################################################## 2023-05-30T17:15:25,170 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:25,171 `description = "'Send a message stored within an mbox using m365 (Office365)'"` 2023-05-30T17:15:25,171 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:25,172 consider this value unless `description` is listed as `dynamic`. 2023-05-30T17:15:25,172 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:25,173 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:25,173 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:25,173 follow strictly the standard. 2023-05-30T17:15:25,174 To prevent this warning, you can list `description` under `dynamic` or alternatively 2023-05-30T17:15:25,174 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:25,175 configuration. 2023-05-30T17:15:25,175 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:25,175 or your builds will no longer be supported. 2023-05-30T17:15:25,176 ******************************************************************************** 2023-05-30T17:15:25,176 !! 2023-05-30T17:15:25,177 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:25,177 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `readme` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:25,177 !! 2023-05-30T17:15:25,178 ******************************************************************************** 2023-05-30T17:15:25,178 ########################################################################## 2023-05-30T17:15:25,179 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:25,179 ########################################################################## 2023-05-30T17:15:25,180 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:25,181 `readme = '# Abstract\n\nThis repository contains a simple python script that (1) processes an\n`mbox` style mailbox file, (2) parses out (typically) the last message\nand then (3) re-transmits this using the CLI `m365` toolset. While this\nscript can be used in a completely stand-alone manner to extract a\nmessage from an `mbox` and then *send* using `m365`, it’s main utility\nis when used in a full ecosystem including an email client and `postfix`\nserver.\n\nThe CLI `m365` offers the ability to use Outlook/Office365 to send\nemails. However, this tool is not suited to use as a mail client\u2009—\u2009it\nmerely offers a means to transmit a message from the command line. More\nuseful would be if existing mail clients could leverage `m365` natively.\nCurrently, however, this is not available. Therefore, `mbox2m365` was\ncreated to complete a "missing link" in a full email experience. Using\nthis tool in a configured environment, it is now possible to use *any*\nemail client to transmit messages using Outlook/Office365.\n\n# TL;DR\n\nEven if you’re impatient, it’s a good idea to read this document.\nHowever, assuming you’ve already built the infrastructure, assuming you\nhave installed `m365` (and logged into your Institution from `m365`),\nhave assuming you have setup your email client to email to a dummy local\npostfix account, then you can install `mbox2m365` with a simple\n\n``` bash\npip install mbox2m365\n```\n\nnote at time of writing the PyPI install might not be available. In that\ncase, simply clone this repo and do a\n\n``` bash\n# From the repo root dir\npip install -U .\n```\n\nand fire it off by setting up the monitor on the `mbox` file (here we\nassume the mbox belongs to `rudolph`)\n\n``` bash\ncd /var/mail\nfind . | entr mbox2m365 --mbox rudolph --b64_encode \\\n --sendFromFile --cleanUp \\\n --waitForStragglers 5\n```\n\n(Clearly the above relies on [`entr`](https://github.com/eradman/entr).\nConsult your distro’s repos for the appropriate install. In arch, this\nis `yay -S entr`, in Ubuntu, this is `sudo apt install entr`)\n\n# Security alert!\n\nWait! **Danger, Will Robinson**! Doesn’t this violate security policies?\nI was told my Institution does *not* allow clients like thunderbird to\nconnect to the Outlook server to send emails!\n\nWell, the devil is in the details as the saying goes. This solution does\n*not* violate policy since the "unauthenticated" email client is *not*\never connecting/authenticating to the Outlook server. Rather, the\n"unauthenticated" email client sends messages to a specially configured\nserver that "saves" the emails to a file. Then, a separate program\nteases out the new arrivals and uses the **authenticated** `m365`\nprogram to actually talk to and leverage Outlook to send the email. This\n*separate program* that bridges the mail file to `m365` is none other\nthan this python module.\n\nSo to be pendantic: all credentialing and authentication is handled by\n`m365` and *not* this tool. The end user is still required to\nlogin/authenticate using `m365`. If this has not happened, then\n`mbox2m365` will not work.\n\nAgain, this repo contains **no** authentication tokens/passwords/etc.\n\n# Limitations\n\nLet’s get these out of the way first. This is *not* a full solution for\nlinking a third party email client to Outlook. It gets *close*, IMHO.\nThe limitations are:\n\n- This is not a multi-user solution. All email transmitted to the\n intermediate helper server is added to a single user `mbox` which when\n processed by this script means **all** email in that `mbox` will\n appear to have been transmitted by that user. While in theory it\n should be possible to support multiple users, either by having a\n separate helper server per user or by having multiple local users on\n the mail server and separate `mbox` files, the current solution is\n clearly not scalable. It is decent though for the single user case.\n\n- Fundmanentally, this solution is limited first and foremost by the\n capabilities of the CLI `m365 outlook mail send` functionality. Recent\n updates to `m365` have expanded functionality of this bridge\u2009—\u2009most\n notably attachments are now supported. Still pending is full `bcc`\n support\u2009—\u2009currently all `bcc` recipients are switched to `cc`.\n\nOther limitations stem from the fact the bridge needs to process the\n`mbox` file *de novo* each time mail is received by the helper server.\nThis means that time to process will increase linearly with `mbox` size.\nThe real world implications of this are still being explored.\n\nFinally, the bridge does make a best effort attempt to *wait* until the\n`mbox` has stabilized before analyzing it. When sending emails to\nmultiple recipients, *each* recipient gets a single complete copy in the\n`mbox` with a single address (the multiple recipient addresses are not\nconserved in the `mbox` but *are* processed by this bridge). While\narguably wasteful, the implication is that while all these recipient\ncopies are appended to the `mbox`, the bridge should wait until all have\nbeen added before processing. Currently the bridge attempts this by\nexamining the `mbox` file size when called, and waiting a small delta\ntime interval and checking if the size has changed again. It will wait\nuntil the size is stable before continuing. The TL;DR is this could\nresult in a processing delay.\n\n# Introduction\n\nThe migration/adoption of Office365 by institutions often poses issues\nand problems for users wishing to use different tools for email\ntransmission, particularly on platforms such as Linux.\n\nWhile it is possible to access various Office365 applications,\nparticularly Outlook, via a web interface, this is often not sufficient\nfor several classes of users, particularly those who find the web\ninterface cumbersome (for instance, the web interface has no (or\nlimited) support for keyboard shortcuts, it is cumbersome if not\nimpossible to automate tasks involving event-driven email) and/or for\nusers who have an existing and efficient email workflow using clients\nsuch as `thunderbird` or `mutt`.\n\nThis small repo houses a small and simple python application with some\nsupporting documentation that provides a solution to the problem of\nsending email from an instituion’s managed domain by leveraging\n`postfix` and some `mbox` processing and then using the CLI tool `m365`.\n\n# Method Summary\n\nThe solution requires some seemingly contortuous steps, but in reality\nis rather simple and can be summarized as follows:\n\n## Reading email\n\nReading emails that are locked away in an Outlook server is best\neffected by simply adding a forward incoming email rule from your\nInstitution Outlook Server (IOS) to an externally accessible email\nprovider (such as `gmail`), allowing this email to be read easily by\ntools such as `thunderbird` or `mutt`.\n\n ┌─────────────────────────────────┐\n │IOS that receives incoming email │\n └┬────────────────────────────────┘\n │\n └─────┐\n │\n ┌O─────────────────────┐\n │forwardRule()│\n └┬─────────────────────┘\n ┌─────┘\n │\n ┌O────┐\n │gmail│\n └┬────┘\n └─────┐\n │\n ┌O──────────────────────┐\n │clientAccess()│\n └O──────────────────────┘\n ┌─────┘\n │\n ┌┴───────────────────────┐\n │thunderbird / mutt / etc│\n └────────────────────────┘\n\n## Sending email\n\nThe message is now outside of Outlook, and if the Institution does not\nallow non-authorized clients (often this means they only allow Microsoft\ntools) to connect to the Outlook server, the following work around will\nhelp. Essentially, the outside client should be configured to send email\nusing a properly setup `postfix` server that simply copies the target\nemail to an `mbox` file.\n\nThis `mbox` file is then monitored for any changes, and on a change\n(assumed to mean a new email message has been appended), a new process\nis fired off to parse off the latest message and then use the command\nline `m365` CLI tool to have the IOS send the email.\n\n ┌───────────────────────┐\n │thundebird / mutt /etc │\n └┬──────────────────────┘\n │\n └─────┐\n │\n ┌O────────────────────────────┐\n │sendmail() (postfix)│\n └┬────────────────────────────┘\n ┌─────┘\n │\n ┌O────┐\n │mbox │\n └┬────┘\n └─────┐\n │\n ┌O────────┐\n │mbox2m365│ <--- this repo!\n └┬────────┘\n ┌─────┘\n │\n ┌O─────────────┐\n │m365 │\n └┬─────────────┘\n │\n ┌O────────────────────────────────┐\n │IOS that transmits outgoing email│\n └─────────────────────────────────┘\n\n# `mbox2m365`\n\nWhile all the building blocks to effect the solution exist, the one\nmissing piece is the `mbox` to `m365` block, which is provided for by\nthis rather simple python script.\n\n# Setup your helper mail server, `postfix`\n\nFirst, install `postfix`\n\n## Arch\n\n``` bash\nyay -S postfix\n```\n\n## Ubuntu\n\n``` bash\nsudo apt install postfix\n```\n\n# `transport`\n\nNow, edit the `transport` file.\n\n``` bash\nsudo bash\ncd /etc/postfix\ncp transport transport.orig\necho "* local:rudolph" >> transport\n```\n\n# `main.cf`\n\nFor the `main.cf` file, do\n\n``` bash\n# Assuming you are still in the /etc/postfix dir in a sudo bash shell...\ncp main.cf main.cf.orig\necho "mydomain = pangea.net" >> main.cf\necho "luser_relay = rudolph@pangea.net"\necho "transport_maps = hash:/etc/postfix/transport" >> main.cf\n```\n\n# enable/restart the services\n\n``` bash\nsudo systemctl enable postfix.service\nsudo systemctl restart postfix.service\n```\n\n# Email client\n\nSimply configure your email client to use the machine running `postfix`\nas your email server. All emails will be appended to the `transport`\nuser’s `mbox` file.\n\n# Fire up `mbox2m365`\n\nThe final piece of the puzzle:\n\n``` bash\ncd /var/mail\nfind . | entr mbox2m365 --mbox rudolph --b64_encode \\\n --sendFromFile --cleanUp \\\n --waitForStragglers 5\n```\n\n*-30-*\n'` 2023-05-30T17:15:25,183 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:25,183 consider this value unless `readme` is listed as `dynamic`. 2023-05-30T17:15:25,184 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:25,184 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:25,185 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:25,185 follow strictly the standard. 2023-05-30T17:15:25,186 To prevent this warning, you can list `readme` under `dynamic` or alternatively 2023-05-30T17:15:25,186 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:25,186 configuration. 2023-05-30T17:15:25,187 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:25,187 or your builds will no longer be supported. 2023-05-30T17:15:25,188 ******************************************************************************** 2023-05-30T17:15:25,188 !! 2023-05-30T17:15:25,188 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:25,772 running bdist_wheel 2023-05-30T17:15:25,808 running build 2023-05-30T17:15:25,809 running build_py 2023-05-30T17:15:25,821 creating build 2023-05-30T17:15:25,821 creating build/lib 2023-05-30T17:15:25,823 creating build/lib/mbox2m365 2023-05-30T17:15:25,825 copying mbox2m365/__main__.py -> build/lib/mbox2m365 2023-05-30T17:15:25,830 copying mbox2m365/mbox2m365.py -> build/lib/mbox2m365 2023-05-30T17:15:25,835 copying mbox2m365/__init__.py -> build/lib/mbox2m365 2023-05-30T17:15:25,840 creating build/lib/jobber 2023-05-30T17:15:25,842 copying jobber/jobber.py -> build/lib/jobber 2023-05-30T17:15:25,845 running egg_info 2023-05-30T17:15:25,865 writing mbox2m365.egg-info/PKG-INFO 2023-05-30T17:15:25,869 writing dependency_links to mbox2m365.egg-info/dependency_links.txt 2023-05-30T17:15:25,872 writing entry points to mbox2m365.egg-info/entry_points.txt 2023-05-30T17:15:25,875 writing requirements to mbox2m365.egg-info/requires.txt 2023-05-30T17:15:25,877 writing top-level names to mbox2m365.egg-info/top_level.txt 2023-05-30T17:15:25,894 reading manifest file 'mbox2m365.egg-info/SOURCES.txt' 2023-05-30T17:15:25,899 reading manifest template 'MANIFEST.in' 2023-05-30T17:15:25,901 adding license file 'LICENSE' 2023-05-30T17:15:25,906 writing manifest file 'mbox2m365.egg-info/SOURCES.txt' 2023-05-30T17:15:25,928 installing to build/bdist.linux-armv7l/wheel 2023-05-30T17:15:25,929 running install 2023-05-30T17:15:25,988 running install_lib 2023-05-30T17:15:25,999 creating build/bdist.linux-armv7l 2023-05-30T17:15:26,000 creating build/bdist.linux-armv7l/wheel 2023-05-30T17:15:26,003 creating build/bdist.linux-armv7l/wheel/jobber 2023-05-30T17:15:26,005 copying build/lib/jobber/jobber.py -> build/bdist.linux-armv7l/wheel/jobber 2023-05-30T17:15:26,011 creating build/bdist.linux-armv7l/wheel/mbox2m365 2023-05-30T17:15:26,012 copying build/lib/mbox2m365/__main__.py -> build/bdist.linux-armv7l/wheel/mbox2m365 2023-05-30T17:15:26,017 copying build/lib/mbox2m365/mbox2m365.py -> build/bdist.linux-armv7l/wheel/mbox2m365 2023-05-30T17:15:26,023 copying build/lib/mbox2m365/__init__.py -> build/bdist.linux-armv7l/wheel/mbox2m365 2023-05-30T17:15:26,026 running install_egg_info 2023-05-30T17:15:26,035 Copying mbox2m365.egg-info to build/bdist.linux-armv7l/wheel/mbox2m365-3.0.16-py3.7.egg-info 2023-05-30T17:15:26,058 running install_scripts 2023-05-30T17:15:26,094 creating build/bdist.linux-armv7l/wheel/mbox2m365-3.0.16.dist-info/WHEEL 2023-05-30T17:15:26,100 creating '/tmp/pip-wheel-4cbznw8g/.tmp-lp_woz8c/mbox2m365-3.0.16-py3-none-any.whl' and adding 'build/bdist.linux-armv7l/wheel' to it 2023-05-30T17:15:26,106 adding 'jobber/jobber.py' 2023-05-30T17:15:26,109 adding 'mbox2m365/__init__.py' 2023-05-30T17:15:26,113 adding 'mbox2m365/__main__.py' 2023-05-30T17:15:26,123 adding 'mbox2m365/mbox2m365.py' 2023-05-30T17:15:26,129 adding 'mbox2m365-3.0.16.dist-info/LICENSE' 2023-05-30T17:15:26,134 adding 'mbox2m365-3.0.16.dist-info/METADATA' 2023-05-30T17:15:26,136 adding 'mbox2m365-3.0.16.dist-info/WHEEL' 2023-05-30T17:15:26,138 adding 'mbox2m365-3.0.16.dist-info/entry_points.txt' 2023-05-30T17:15:26,140 adding 'mbox2m365-3.0.16.dist-info/top_level.txt' 2023-05-30T17:15:26,142 adding 'mbox2m365-3.0.16.dist-info/RECORD' 2023-05-30T17:15:26,145 removing build/bdist.linux-armv7l/wheel 2023-05-30T17:15:26,157 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `license` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:26,158 !! 2023-05-30T17:15:26,159 ******************************************************************************** 2023-05-30T17:15:26,159 ########################################################################## 2023-05-30T17:15:26,160 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:26,160 ########################################################################## 2023-05-30T17:15:26,161 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:26,162 `license = 'MIT'` 2023-05-30T17:15:26,163 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:26,163 consider this value unless `license` is listed as `dynamic`. 2023-05-30T17:15:26,164 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:26,165 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:26,165 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:26,166 follow strictly the standard. 2023-05-30T17:15:26,167 To prevent this warning, you can list `license` under `dynamic` or alternatively 2023-05-30T17:15:26,167 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:26,168 configuration. 2023-05-30T17:15:26,169 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:26,169 or your builds will no longer be supported. 2023-05-30T17:15:26,170 ******************************************************************************** 2023-05-30T17:15:26,171 !! 2023-05-30T17:15:26,171 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:26,172 /tmp/pip-build-env-c_wzz7rc/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `authors` defined outside of `pyproject.toml` would be ignored. 2023-05-30T17:15:26,172 !! 2023-05-30T17:15:26,173 ******************************************************************************** 2023-05-30T17:15:26,173 ########################################################################## 2023-05-30T17:15:26,174 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-05-30T17:15:26,174 ########################################################################## 2023-05-30T17:15:26,175 The following seems to be defined outside of `pyproject.toml`: 2023-05-30T17:15:26,176 `authors = 'Rudolph Pienaar'` 2023-05-30T17:15:26,177 According to the spec (see the link below), however, setuptools CANNOT 2023-05-30T17:15:26,177 consider this value unless `authors` is listed as `dynamic`. 2023-05-30T17:15:26,178 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-05-30T17:15:26,178 For the time being, `setuptools` will still consider the given value (as a 2023-05-30T17:15:26,179 **transitional** measure), but please note that future releases of setuptools will 2023-05-30T17:15:26,179 follow strictly the standard. 2023-05-30T17:15:26,180 To prevent this warning, you can list `authors` under `dynamic` or alternatively 2023-05-30T17:15:26,180 remove the `[project]` table from your file and rely entirely on other means of 2023-05-30T17:15:26,181 configuration. 2023-05-30T17:15:26,182 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-05-30T17:15:26,182 or your builds will no longer be supported. 2023-05-30T17:15:26,183 ******************************************************************************** 2023-05-30T17:15:26,184 !! 2023-05-30T17:15:26,184 _handle_missing_dynamic(dist, project_table) 2023-05-30T17:15:26,350 Building wheel for mbox2m365 (pyproject.toml): finished with status 'done' 2023-05-30T17:15:26,363 Created wheel for mbox2m365: filename=mbox2m365-3.0.16-py3-none-any.whl size=19436 sha256=568f57fcd89807e61a8fc09c23259f313f8d280c51b7a18ebd42ed73fecfd38c 2023-05-30T17:15:26,365 Stored in directory: /tmp/pip-ephem-wheel-cache-xiulzkwm/wheels/af/d1/9a/0b34449ada752f340f35b0499c24a5ca9284cc6cb1988c3a30 2023-05-30T17:15:26,398 Successfully built mbox2m365 2023-05-30T17:15:26,406 Removed build tracker: '/tmp/pip-build-tracker-xigxwp1v'