Merge pull request 'feat: neomutt post' (#1) from dev into main
All checks were successful
Release CI action / build-and-push-container (push) Successful in 3m26s

Reviewed-on: #1
This commit is contained in:
agj 2025-01-11 15:35:57 +00:00
commit 720d81a12c
7 changed files with 125 additions and 2 deletions

View File

@ -1,3 +1,20 @@
# gtz blog # gtz blog
An opinionated blog. An opinionated blog.
I write posts about technology and other interests that I have. I write posts about technology and other interests that I have.
To iterate locally:
```sh
docker build -t wip .
docker run --rm -it -p 8080:8080 wip hugo serve --bind 0.0.0.0 --port 8080
```
## Things I want to write
### Opinion Piecese
- [ ] Clean Architecture is stupid - dependency injection is king
### Digital Soverignty
- [x] how to host a blog
- [ ] how to securely "self-host" using a VPS, portainer and traefik
- [ ] how to configure neomutt
- [ ] how to securely host a mail server

View File

@ -3,5 +3,17 @@ title: About gtz blog
author: Asger Gitz-Johansen author: Asger Gitz-Johansen
--- ---
This is just a simple blog. I am a software engineer from Denmark working at [GomSpace](https://gomspace.com/home.aspx).
<!-- TODO: Add more shit about myself. --> This is just my simple blog that I use for letting out "blogging-steam".
I write GNU/Linux based tutorials and sometimes I write opinion pieces.
I hope you find my stuff useful.
If you want more from me, check my links:
- [GitHub](https://github.com/sillydan1)
- [Model Based Development Paper 1](https://github.com/sillydan1/aaltitoad/blob/master/.github/resources/docs/SW9__AALTITOAD.pdf)
- [Model Based Development Paper 2](https://github.com/sillydan1/aaltitoad/blob/master/.github/resources/docs/SW10__Tick_Tock_Automata.pdf)
- [Model Based Development Paper 3](https://github.com/sillydan1/aaltitoad/blob/master/.github/resources/docs/aaltitoad-v1.0.0.pdf)
- [Graphedit](https://github.com/sillydan1/graphedit) (in hibernation)
- [AALTITOAD](https://github.com/sillydan1/aaltitoad) (in hibernation)
{{< centered image="/6616144.png" >}}

View File

@ -5,4 +5,7 @@ title = 'Example'
tags = ['tutorial'] tags = ['tutorial']
categories = ['technical'] categories = ['technical']
+++ +++
content goes here. content goes here.
{{< centered image="/6616144.png" >}}

View File

@ -0,0 +1,89 @@
+++
date = '2025-01-11'
title = 'Neomutt and Outlook'
tags = ['howto', 'tutorial', 'mutt', '2fa', 'oauth2']
categories = ['technical']
+++
Neomutt is a great way to read, send and manage your email.
In this tutorial we will configure neomutt to be able to synchronize e-mails with Outlook (or other popular e-mail provider) addresses!
By the end of this tutorial, you will be able to manually synchronize your emails using the `mailsync` command and read/manage your emails in an interface that looks like so:
{{< centered image="/neomutt-screenshot.png" >}}
Apologies for the blur, but I dont want you to read **my** e-mails.
## First Things First
First, sign in to your mail through the browser. This is needed for the OAuth2 authorization flow.
You should also obviously install neomutt.
This can just be done through your package manager.
As I am using Arch linux, I will do so using `pacman`, but on Ubuntu or Debian you should use `apt`:
```sh
pacman -S neomutt
```
## GPG
The first thing you'll need is a `gpg` key for encryption purposes.
You can check your keys using `gpg --list-keys`.
If you don't already have a `gpg` key, you can generate one with the `--full-gen-key` flag.
```sh
gpg --full-gen-key
```
## OAuth2
As part of installing neomutt, you should have the oauth2 python script located in `/usr/share/neomutt/oauth2/`.
We need to register neomutt as an already trusted app.
We will simply abuse the thunderbird client-id for this, which is: `9e5f94bc-e8a4-4e73-b8be-63364c29d753` - with this you don't need to specify a client secret:
```sh
/usr/share/neomutt/oauth2/mutt_oauth2.py \
-v \
-t \
--authorize \
--client-id "9e5f94bc-e8a4-4e73-b8be-63364c29d753" \
--client-secret "" \
--email "your-email-here" \
--provider microsoft \
$HOME/email-token
```
This will ask you a couple questions.
Select `authcode` for the preferred OAuth2 flow.
If prompted for a client secret, simply press enter.
You should get a link - enter that link into your browser and allow the app.
By the end of the flow you should end up at an empty website.
Copy the last part of the URL and paste it into your terminal.
After this you should have a token file located at `$HOME/email-token`.
It's a good idea to take a backup of this file just in case you overwrite it.
But if you do loose it, you can just run the flow again.
## Mutt-Wizard
We are almost there!
The wonderful Luke Smith has made a neat setup wizard called [mutt-wizard](https://muttwizard.com/).
Install (see the mutt-wizard website), run it and enter your email information.
After this, you should edit your `~/.mbsyncrc` file, as the default `PassCmd` is not quite configured yet.
It should look something like this (make sure to change `your-email-here` and `username` to the appropriate values):
```
...
PassCmd "/usr/share/neomutt/oauth2/mutt_oauth2.py --encryption-pipe 'gpg -e -r your-email-here' /home/username/email-token"
...
```
You should now be able to run `mailsync` (installed with mutt-wizard):
```sh
mailsync
```
It might ask you to select which profile to sync.
Just provide the name you set when setting up your gpg profile and everything should sync now!
After a successful sync, you should be able to just open `neomutt` and start reading, replying and whatever you do with email!
```sh
neomutt
```
{{< centered image="/6616144.png" >}}

View File

@ -209,3 +209,5 @@ Just focus on writing posts and publish them by merging to `main`. Nice and auto
## P.S. ## P.S.
You may notice that the CI script on the real blog repository is a bit more complicated than what we've went through in this post, but the extra complexity only comes from some stupid technicalities regarding my build server being based on ARM rather than x86 (raspberry pi). You may notice that the CI script on the real blog repository is a bit more complicated than what we've went through in this post, but the extra complexity only comes from some stupid technicalities regarding my build server being based on ARM rather than x86 (raspberry pi).
The script we made here is plenty good to get you started. The script we made here is plenty good to get you started.
{{< centered image="/6616144.png" >}}

BIN
static/6616144.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB