The goal

First step was to get a concrete idea of what I actually wanted to do, and based on that, to choose a language. The start is a mail. The goal is a page on my web page. My web page uses markdown files for posts/content. That more or less involves these three steps:

Get mail -> Convert to format usable by web page -> Add to web page

Get mail:

I can create an extra account on my mail server. Then I need to get the mails from that account. My mail server is accessible via IMAP. (Most are, I guess..) IMAP should be easy to work with in a lot of languages. But I would prefer to find a language that have as easy a library for IMAP servers as possible.

Convert to a format usable by web page:

The mails I intend to send, only contains text. Markdown is text. So I need to wrangle some strings. Most languages do that easy enough. But again, if I could find a library, that could get the exact things I wanted from the mails, would it be nice.

Add to weblog:

My web page is made with Hugo. Hugo can take Markdown files and use those for posts. It then needs to be rendered. There might be some specific ways to do that by different languages. But my intent is to use a deployment script I already have. It is written in bash, so a subprocess.call should do it.

Choose language:

My intention is to get something working fast. Not to write the most beautiful code, or learn some new coding paradigm. So a language I already know, or one that is simple to get going. I haven’t used python for a while. But while I have never really taken the time to learn it in depth, it have always been easy and fast to get going and working. And Python usually have a lot of libraries for everything.

After a short search I found some libraries for working with IMAP and mails, that seems to do what I want.

Next post will be about how to get the mail. And get the correct data from them.