Inbox Translator: Automatic Email Translation Made Easy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5168

    #1

    Inbox Translator: Automatic Email Translation Made Easy

    This is a submission for the Postmark Challenge: Inbox Innovators.


    What I Built

    Inbox Translator is an AI-powered email translation app that automatically translates incoming emails into English using OpenRouter’s GPT-3.5-turbo model. Integrated with Postmark’s inbound email parsing, the app listens for emails sent to a dedicated address, translates their content seamlessly, and sends back the translated message to the sender.


    Designed with a sleek, dark-themed, responsive UI, Inbox Translator offers users a simple way to overcome language barriers in email communication without any manual effort. This solution is ideal for professionals, businesses, and anyone who regularly receives emails in different languages and wants fast, reliable translations directly in their inbox.


    Demo

    Demo link


    Code Repository

    Repo Link


    How I Built It

    🛠 Step-by-Step Guide: Building the Inbox Translator App


    1️⃣ Project Setup

    Tools: Node.js, Express, EJS, TailwindCSS


    Initialized the project using npm init


    Installed required packages:

    npm install express ejs body-parser dotenv postmark node-fetch



    Set up project folders:

    /views → EJS templates

    /public → Static CSS (Tailwind)

    index.js → Main server logic

    .env → Environment config






    2️⃣ Set Up Postmark for Inbound Emails

    Steps:

    Created a Postmark account and set up a new Inbound Stream.

    Set your Inbound Webhook URL to your deployed endpoint:

    (https://inbox-translator.onrender.com/inbound-email)


    Verified the domain or used Postmark’s testing domain (inbound.postmarkapp.com)




    3️⃣ Handling Incoming Emails

    How it works:

    The webhook /inbound-email receives incoming email data from Postmark.

    It logs the sender and the original message content.








    4️⃣ Language Detection & Conditional Translation

    Tools: LibreTranslate + OpenRouter GPT-3.5


    Used LibreTranslate to detect if the email is already in English.


    If not, used OpenRouter (GPT-3.5-turbo) to translate the message to English.


    Example logic:if (language !== 'en') {

    // translate using OpenRouter AI

    }



    5️⃣ Sending Back the Translated Email

    Used Postmark’s sendEmail method to reply to the original sender.


    Dynamic subject and body:Subject: "Translated Email (Inbox Translator)"

    TextBody:Here is your translated message:\n\n${translatedText}






    6️⃣** Frontend UI — Viewing Translations**

    Tools: EJS + Tailwind CSS


    Created a dark-themed interface to display email history.


    Emails are stored in-memory and rendered as responsive cards.


    Added a dark/light toggle and smooth animations.





    Summary: Tech Stack


    Backend Node.js + Express
    Frontend EJS + Tailwind CSS
    Email Engine Postmark (Inbound + Outbound)
    Translation GPT-3.5-turbo via OpenRouter
    Deployment Render.com




    More...
Working...