Nicolas Cognaux - Tech entrepreneur & engineer

I share about development, productivity, open source and entrepreneurship.

Inbox2API: Make your API receive emails

2024-09-11 Nicolas Cognaux 3 min readPersonal projects

I was less active for some months. I worked on multiple big projects. I just challenged myself to take small components from those projects and publish them standalone. That’s how I built appea.link and notnow.co. So here is the first one I publish:

Inbox2API: Connect email addresses to API endpoints

The aim of the project is to generate email addresses connected to API endpoints. Inbox2API translates emails to POST requests which can easily be processed.

Actually, I used the base of it to build notnow.co when I recoded it for scalability and other tools.

Why use Inbox2API?

With the different projects I worked on, I already identified multiple interesting use cases.

Don’t change habits

I worked on a project for travel agencies. They want input data automatically to a platform but don’t want to change tools, and they already send that data to their customers. The easy solution is thus to CC a specific email address.

That’s where Inbox2API comes in: For each trip, Inbox2API generates a temporary email address connected to the database. When the travel agent sends the email to their customer, they simply CC that temporary email address.

The email is received and processed by the API directly. The user doesn’t have to change tools, and the process is well understood.

Accounting and invoices

As a freelancer, I often send and receive invoices. Tracking all of them is a bit cumbersome, and I tend to forget to encode them, resulting in long searches afterwards.

To avoid that issue, I created a specific email address connected to n8n (via Webhook). When an email is received, my automation analyzes it and adds it to a database with the extracted info (company, address, amount, VAT, etc.). At the end of the month, I receive a ZIP with a summary and all the invoices. Super easy for my accountant to process.

Easy mobile file upload

On mobile, file permissions are usually blocked by users, and some of them have trouble understanding file systems. Usually, sending an email with an attachment is easier than designing an upload system with permission management and an easy interface.

So I used Inbox2API to generate a new email address each time a user wants to send a file. Just present the mailto: link and wait for your API to receive the file. I worked on three apps that do that, and users never complain.

And how does it work?

At the heart of Inbox2API, there is Postfix, a powerful mail router, but super complicated. I tweaked it to only relay emails to a local process that sends the POST request to the right URL (based on rules you define). Everything runs in a Docker container, helping with scalability and portability.

The setup is pretty easy:

  1. Create an MX record in your DNS config for a specific subdomain. For example, upload.gp2mv3.com. Set the record to in.inbox2api.com. Each email received at [email protected] will be ingested by Inbox2API.
  2. Create a rule in Inbox2API. Rules define which email address will be sent to which URL endpoint.
  3. That’s it! Now simply send an email to an address matching your rule, and you’ll see a request to your API.

Email rules can be created via REST API or manually in the Dashboard of Inbox2API. I usually use the API, but the dashboard also displays emails received, their states, errors, and histories. The API doc is available here: Inbox2API Doc

So, why don’t you try it? Inbox2API

Don't miss an episode!

Nicolas Cognaux (Gp2mv3) - Tech entrepreneur & engineer

About Nicolas Cognaux

Entrepreneur and CTO. I’m an electrical engineer and passionate about software development. I post about technologies, entrepreneurship, projects, and geeky stuff. Follow me on social media to stay updated.

Don't miss an episode!

  • Made with ❤️ in Belgium 🇧🇪 by @Gp2mv3