The tool acts as a domain level email client for AWS SES and can be used to send and receive emails just like you would with Gmail or Outlook. The app is built using React and styles using custom, handwritten css.
Here's what the inbox looks like live.
Full Disclosure - the search function does not work at all. The search box is just for decorative purposes for now. To be fait, I haven't missed it all that much since I've been using my own inbox. The comments function is also broken right now but I will be fixing it soon.
To function correctly, the client relies on three APIs. The APIs are covered in more detail later.
LIST [GET]
- returns a list of the most recent N emails (newest first) received by AWS SES on your domainEMAIL [GET]
- returns the contents of the eml file received by AWS in JSON formatSEND [POST]
- POSTs a JSON object containing all the details necessary to send a raw email via SES
If you want to build a read-only inbox, remove support for the last API
This client is secured using AWS Cognito
- User visits the url on which this email client is running
- User is redirected to AWS Cognito to login
- Cognito redirects the user back to the url in step 1 along with
id_token
andaccess_token
- App extracts
id_token
andaccess_token
and saves it in localstorage (not ideal, TO-DO: needs to be stored somewhere safer)
- Using the
id_token
as the Authorization: header, the app queries theLIST
api to download the most recent emails - Then, using the
EMAIL
api, it downloads the contents of each email to determine which email address the email was sent to - Then, it creates BUCKETS on the client side. The name of each bucket is the unique email address on which you received emails. Recall that this is a domain level inbox client so if you received emails send to gym@example.com and shopping@example.com, the client will show you two buckets -
Gym
andShopping
- There are three default buckets called ALL, SPAM, and SENT - ALL shows all emails, SPAM shows emails suspected to be spam, and SENT shows emails sent by you or anyone else using your domain's email client
- The client comes with a built-in email composer built using
jodit-react
- Emails are dispatched using the SEND api using AWS SES's
send-raw-email
endpoint - If you are replying to a received email, the client calls the SEND api with an extra value -
References <mesage-id>
where<message-id>
is the id of the message to which you are replying. The API uses this value to include theReferences
andIn-Reply-To
headers while callingsend-raw-email
- By default, each email is also BCC-ed to a secret inbox so that you can review your SENT emails later
-
LIST - this GET API returns a list of most recently received emails. API endpoint is
EMAILS_LIST_URL
inconstants.js
. @domain: domain name on which emails are received E.g., ramachandr.in @folderpath: /path/to/folder containing the raweml
files Returns list of eml file ids -
EMAIL - this GET API returns the content of a single eml file. API endpoint is
EMAILS_CONTENT_URL
inconstants.js
. @domain: domain name on which emails are received E.g., ramachandr.in @id: path/to/emlfiles/abcdefghi1234567890 Returns the contents of the email file as a JSON object as parsed by nodemailer -
SEND - this POST API calls the lambda which sends raw emails on our behalf. API endpoint is
EMAILS_CONTENT_URL
inconstants.js
. @domain: domain name on which emails are received E.g., ramachandr.in Returns success or failure status of request to send email. Email sending happens synchronously.