# Email app

In this tutorial, you will learn how to build **an email app that works entirely on the SAFE Network**!

Instead of relying on an email service provider such as Gmail, or going through the trouble of running your own mail server, you can use the SAFE Network to build dynamic applications such as email and messaging apps.

The emails you send using **SAFE Mail Tutorial** are encrypted using the public [encryption key](https://api.safedev.org/low-level-api/appendable-data/encryption-key/) of the recipient. This means that only the recipient of an email is able to read its content. This example app demonstrates the usage of [private appendable data](https://api.safedev.org/low-level-api/appendable-data/).

#### Contents

![Inbox page](https://3287240797-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M2iQcySPVDTOOrtj1Mi%2F-M2iQd_zdonbfes7H0XS%2F-M2iQe-pk4g2x03kbyBf%2Finbox-page.png?generation=1584548195499042\&alt=media)

## Overview

This tutorial will showcase how to:

* [Fetch email data](https://safenetwork.gitbook.io/safe-dev-tutorials/email-app/fetch-email-data)
* [Create an email ID](https://safenetwork.gitbook.io/safe-dev-tutorials/email-app/create-an-email-id)
* [Send an email](https://safenetwork.gitbook.io/safe-dev-tutorials/email-app/send-an-email)
* [Refresh the inbox folder](https://safenetwork.gitbook.io/safe-dev-tutorials/email-app/refresh-the-inbox-folder)
* [Save an email](https://safenetwork.gitbook.io/safe-dev-tutorials/email-app/save-an-email)
* [Delete an email](https://safenetwork.gitbook.io/safe-dev-tutorials/email-app/delete-an-email)

### SAFE APIs

You will learn about the following APIs:

* [Authorization](https://api.safedev.org/auth/)
* [NFS](https://api.safedev.org/nfs/)
* [Structured Data](https://api.safedev.org/low-level-api/structured-data/)
* [Appendable Data](https://api.safedev.org/low-level-api/appendable-data/)
* [Data Identifier](https://api.safedev.org/low-level-api/data-id/)
* [Immutable Data](https://api.safedev.org/low-level-api/immutable-data/)
* [Cipher Options](https://api.safedev.org/low-level-api/cipher-options/)

#### External libraries

* [React](https://facebook.github.io/react/)
* [Redux](http://redux.js.org/)
* [React Router](https://github.com/ReactTraining/react-router)

## Source code

[Browse **the source code of the SAFE Mail Tutorial** on GitHub](https://github.com/maidsafe/safe_examples/tree/master/email_app).

[electron-react-boilerplate](https://github.com/chentsulin/electron-react-boilerplate) was used as a starting point.

### Binaries

[Download **SAFE Mail Tutorial v0.1.2** on GitHub](https://github.com/maidsafe/safe_examples/releases/tag/0.9.0).

Since this app is built using [Electron](http://electron.atom.io/), it can be distributed as a desktop app (Windows, OS X and Linux).

### Building from source

#### Requirements

**1. SAFE Launcher**

Start [SAFE Launcher v0.10.0](https://github.com/maidsafe/safe_launcher/releases/tag/0.10.0) and log in.

**2. Node.js**

Make sure you have Node.js v6 (LTS).

```
node --version
```

There are many ways to install Node.js. See [nodejs.org](https://nodejs.org/en/download/) for more info.

#### Setup

**1. Clone this GitHub repository**

```
git clone https://github.com/maidsafe/safe_examples.git
```

If you don't have Git installed, you can download it from [git-scm.com](https://git-scm.com/downloads).

**2. Install the dependencies**

```
cd safe_examples/email_app && npm install
```

**3. Start the app**

```
npm run dev
```
