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 provided by edX platform.
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
POSTrequest is made to/emails, passing in values forrecipients,subject, andbody. - 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
GETrequest to/emails/<mailbox>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
GETrequest is made to/emails/<email_id>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
PUTrequest is made to/emails/<email_id>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
PUTrequest is made to/emails/<email_id>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
recipientfield set to whoever sent the original email. - The
subjectline is pre-filled. If the original email had a subject line offoo, the new subject line should beRe: foo. (If the subject line already begins withRe:, no need to add it again.) - The
bodyof 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.
The app is built using Django framework. To install Django via terminal, use the following command.
$ pip3 install DjangoTo run mail locally,
- Clone this repo.
cdinto project directory.- Start the Django web server.
$ python manage.py runserver
- Access
127.0.0.1:8000in your browser.
The repo contains test database. To reset database,
- Delete db.sqlite3 file.
- Run the following command.
$ python manage.py flushAlexandra Baturina



