https://github.com/alexandrabaturina/mail
Front-end for an email client that makes API calls to send and receive emails
https://github.com/alexandrabaturina/mail
api django-backend javascript-frontend
Last synced: 8 months ago
JSON representation
Front-end for an email client that makes API calls to send and receive emails
- Host: GitHub
- URL: https://github.com/alexandrabaturina/mail
- Owner: alexandrabaturina
- Created: 2020-08-25T16:52:03.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T04:18:59.000Z (almost 6 years ago)
- Last Synced: 2025-02-14T20:39:28.173Z (over 1 year ago)
- Topics: api, django-backend, javascript-frontend
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Project 3: Mail
## Overview
The current repo contains project called **mail** which is a front-end for an email client that makes API calls to send and receive emails.
This project is built as Project 3 for [CS50W 2020 course](https://courses.edx.org/courses/course-v1:HarvardX+CS50W+Web/course/) provided by edX platform.
## Features
The project meets the following requirements.
* **Send Mail**
* When a user submits the email composition form, the email is sent (this option is built with JavaScript).
* A ```POST``` request is made to ```/emails```, passing in values for ```recipients```, ```subject```, and ```body```.
* Once the email has been sent, the user’s ***Sent*** mailbox is loaded.
* **Mailbox**
* When a user visits their ***Inbox***, ***Sent*** mailbox, or ***Archive***, the appropriate mailbox is loaded.
* A ```GET``` request to ```/emails/``` is made to request the emails for a particular mailbox.
* When a mailbox is visited, the application first queris the API for the latest emails in that mailbox.
* When a mailbox is visited, the name of the mailbox appears at the top of the page (this part is done in starter code).
* Each email is rendered in its own box that displays who the email is from, what the subject line is, and the timestamp of the email.
* If the email is unread, it appears with a white background. If the email has been read, it appears with a gray background.

* **View Email**
* When a user clicks on an email, they are taken to a view where they see the content of that email.
* A ```GET``` request is made to ```/emails/``` to request the email.
* The application shows the email’s sender, recipients, subject, timestamp, and body.
* Once the email has been clicked on, it is marked as read. A ```PUT``` request is made to ```/emails/``` to update whether an email is read or not.

* **Archive/Unarchive**
* Users are allowed to archive and unarchive emails that they have received.
* When viewing an ***Inbox*** email, the user is presented with a button that lets them archive the email. When viewing an ***Archive*** email, the user should is with a button that lets them unarchive the email. This requirement does not apply to emails in the ***Sent*** mailbox.
* A ```PUT``` request is made to ```/emails/``` to mark an email as archived or unarchived.
* Once an email has been archived or unarchived, the user’s ***Inbox*** is loaded.

* **Reply**
* Users are allowed to reply to an email.
* When viewing an email, the user are presented with a “Reply” button that lets them reply to the email.
* When the user clicks the “Reply” button, they are taken to the email composition form.
* The composition form is pre-filled with the ```recipient``` field set to whoever sent the original email.
* The ```subject``` line is pre-filled. If the original email had a subject line of ```foo```, the new subject line should be ```Re: foo```. (If the subject line already begins with ```Re: ```, no need to add it again.)
* The ```body``` of the email is pre-filled with a line like ```"On Jan 1 2020, 12:00 AM foo@example.com wrote:"``` followed by the original text of the email.

## Dependencies
The app is built using *Django* framework. To install Django via terminal, use the following command.
```sh
$ pip3 install Django
```
## Getting Started
### Running Locally
To run **mail** locally,
1. Clone this repo.
2. ```cd``` into project directory.
3. Start the Django web server.
```
$ python manage.py runserver
```
4. Access ```127.0.0.1:8000``` in your browser.
### Resetting a Database
The repo contains test database. To reset database,
1. Delete **db.sqlite3** file.
2. Run the following command.
```sh
$ python manage.py flush
```
## Authors
Alexandra Baturina