Follow the script's installation wizard to connect the database and configure the admin settings.
A temporary email platform relies on three main components to function seamlessly. 1. The Mail Transfer Agent (MTA) temp mail script 2021
Safely parses and serves files without exposing your web server to malicious code execution. Follow the script's installation wizard to connect the
const SMTPServer = require('smtp-server').SMTPServer; const simpleParser = require('mailparser').simpleParser; const MongoClient = require('mongodb'); // Database Configuration const client = new MongoClient('mongodb://localhost:27017'); let db; async function initDb() await client.connect(); db = client.db('tempmail'); // Automatically delete emails after 10 minutes (600 seconds) await db.collection('messages').createIndex( "createdAt": 1 , expireAfterSeconds: 600 ); // Start SMTP Server const server = new SMTPServer( allowInsecureAuth: true, authOptional: true, onData(stream, session, callback) simpleParser(stream, async (err, parsed) => if (err) return callback(err); const emailData = to: parsed.to.text, from: parsed.from.text, subject: parsed.subject, text: parsed.text, html: parsed.html, createdAt: new Date() ; await db.collection('messages').insertOne(emailData); return callback(); ); ); initDb().then(() => server.listen(25, '0.0.0.0', () => console.log('SMTP Catch-All Server running on port 25'); ); ); Use code with caution. Step 2: Creating the Fetch API The Mail Transfer Agent (MTA) Safely parses and
Build a simple HTTP API to allow the frontend to fetch emails for specific temporary addresses. You can use the native Node.js http module or install express . javascript