Skip to content
Webmail/email module for Magic
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information. Sanity checking that AttachmentsFolder exists during creation Apr 14, 2019 Delete EmailCount.cs Mar 30, 2019

Magic Email

Magic Email is an email module for Magic. It's basically an additionally helper starter kit project(s), for those cases when you need to connect to a POP3 server to store emails into your database, and you want to create an HTTP REST API wrapping these emails, allowing some sort of client to access these emails. In addition, it also allows you to create and send emails over SMTP. Effectively, it's effectively a "GMail starter kit" allowing you to create your own GMail/webmail server system in .Net, built around the Super DRY ideas of Magic.

Creating a webmail backend with Magic

Getting started

  1. Download Magic Core
  2. Download Magic Email
  3. Unzip Magic Email into your Magic folder's "modules" folder, and make sure the folder is named only ""
  4. Add all Magic Email projects into your solution (see below)
  5. Add a reference to and to your backend, which is normally called "magic.backend" (see below)

If you're using dotnet CLI, you can run the following commands in a terminal window to add all Magic Email projects into your main Magic solution.

dotnet sln add modules/
dotnet sln add modules/
dotnet sln add modules/
dotnet sln add modules/
dotnet sln add modules/
dotnet sln add modules/

To add a reference to your controller and service using the dotnet CLI, you can issue the following terminal commands from the root of your Magic folder, assuming your main backend is called "magic.backend".

dotnet add magic.backend reference modules/
dotnet add magic.backend reference modules/

SMTP settings

Although you can create as many POP3 accounts as you wish, by simply inserting a new record into your EmailAccounts database table - Magic Email will only use one SMTP server by default. To configure this server, you need to add the following to your appsettings.json file. Exchange your actual SMTP settings with your own credentials.

"smtp": {

Exchange the above credentials with whatever SMTP server you wish to use. The above provdes the default settings when wanting to use GMail. When you create your POP3 account settings, you might want to make sure you supply "files/" as your attachment folder.

Start debugging your backend to launch Swagger, and checkout for instance the "EmailAccounts" HTTP REST endpoints to verify you did everything correctly.

Security concerns

There is no authentication or authorization features in Magic Email. In a real application, you will have to apply security yourself. However, this is easily accomplished by for instance using Magic Auth, and secure your Magic Email HTTP REST endpoints with the [Authorize] attribute.


Magic Email is licensed as Affero GPL, which implies that you can only use it to create Open Source software - However, a proprietary enabling license can be obtained for €50 by following this PayPal link and pay me €50 - At which point you are free to create one closed source web app. If you want to create multiple closed source web APIs using Magic, you'll have to purchase one license for each web API project you want to create.

Notice, without a closed source license, your code automatically becomes Open Source, and you'll have to provide a link to your own source code from any website(s), and/or application(s) from where you are consuming your Magic web API. With a closed source license, you can create closed source code, and you don't have to provide a link to neither me, nor your own source code.

Send more Champagne

Quote by Karl Marx

You can’t perform that action at this time.