The back-end is deployed on at Heroku.
- The IMAP service retrieves and stores new email messages into a PostgreSQL database.
- Endpoints are exposed to enable the front-end to:
- Retreive a list of message meta-data (to, from, subject, etc) in a pageable format
- Retreive all the data for a specific message (meta-data + body)
- Search for specific fields (from, to, etc) in messages and return those messages that match
- Send a message via SMTP
NOTE: All DS functionality has been disabled/commented-out since we had no DS contributors
Backend delpoyed at Heroku
To get the server running locally:
npm install
to install all required dependenciesnpm run server
to start the local server on port 8000
- node
- cors
- dotenv
- helmet
- express
- knex
- imap-simple
- mailparser
- nodemailer
Note: ALL ROUTES ARE PRIVATE (for the use of the front-end only)
Given a label (typically "inbox"), a list of messages will be returned along with the total count
URL : /emails/label/:label/:page
Method : GET
Condition : If everything is OK.
Code : 200 OK
Content example
{
"totalCount": {
"count": 204
},
"messages": [
{
"id": 317,
"name": "Wish",
"subject": "Buy Pillows",
"date": "1588260629000.0",
"email_body_text": "Hello world..."
},
{ ... }
]
}
Condition : If no messages are found.
Code : 200 OK
Content example
{
"totalCount": {
"count": 0
},
"messages": []
}
Retrieves all the information for a specific message
URL : /emails/email/:id
Method : GET
Condition : If message exists.
Code : 200 OK
Content example
[
{
"id": 1,
"message_id": "<98f29004-6c77-308b-0201-36cec79677fc@gmail.com>",
"from": "taggerlabs20@gmail.com",
"name": "",
"to": "receiver_email@service.com",
"subject": "HERE COMES THE SPAM",
"email_body": "0",
"email_body_text": "WE'RE GOIGN TO JAM, YOUR MAILBOX FULL OF SPAM!\n",
"read": 0,
"date": "1580157214000.0",
"uid": 3,
"labels": "\\Inbox",
"gMsgId": "1656914933919808974",
"gmThreadID": "1656914933919808974",
"user_id": 1
}
]
Condition : If message is not found.
Code : 200 OK
Content example
[]