A modern, privacy-focused temporary email service built with React, Vite, and Tailwind CSS. Instantly create disposable inboxes for secure, anonymous, and spam-free email communication.
TempBox is a frontend application that provides users with temporary, self-destructing email addresses that expire after 10 minutes. Perfect for sign-ups, verifications, and protecting your primary email from spam. The application requires no account creation and prioritizes user privacy above all else.
- 10-Minute Self-Destructing Inboxes: Create temporary email addresses that automatically expire after 10 minutes
- No Account Required: Completely anonymous usage—no registration, no data collection, no tracking
- Real-Time Email Updates: Receive emails instantly with live polling and updates
- One-Click Copy: Easily copy your temporary email address with a single click
- Privacy-First Design: Built with privacy as a core principle; all data is ephemeral
- Responsive Mobile UI: Beautiful, modern interface optimized for all devices
- Dark Mode Support: Seamless dark/light theme toggle
- Blog & Educational Content: Learn about digital privacy and email security
- User Feedback: Built-in feedback system to share suggestions
- Open Source: Community-friendly and self-hosting ready
- React 18+ - UI framework with hooks
- Vite - Lightning-fast build tool
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- PostCSS - CSS processing with autoprefixer
- React Query (@tanstack/react-query) - Server state management with caching and polling
- React Hooks - Local state management
- Lucide React - Beautiful, consistent icons
- react-hot-toast - Elegant notifications
- DOMPurify - HTML sanitization for email content
- date-fns - Date formatting and manipulation
├── dist/ # Production build output
├── public/ # Static assets
├── src/
│ ├── components/
│ │ ├── AuthModal.tsx # Authentication (reserved for future use)
│ │ ├── BlogModal.tsx # Blog post display modal
│ │ ├── InboxManager.tsx # Main inbox interface
│ │ ├── Logo.tsx # Logo component
│ │ ├── MessageViewer.tsx # Email message display
│ │ ├── SystemStats.tsx # System statistics display
│ │ ├── ThemeToggle.tsx # Dark/light mode toggle
│ │ └── UserStatus.tsx # User status display
│ ├── data/
│ │ └── blog.ts # Blog posts data
│ ├── hooks/
│ │ ├── useInbox.ts # Inbox management hook
│ │ ├── useMessage.ts # Message fetching hook
│ │ └── useTheme.ts # Theme preference hook
│ ├── services/
│ │ ├── authService.ts # Authentication logic
│ │ ├── cleanupService.ts # Auto-cleanup on expiry
│ │ ├── mailApi.ts # Mail.tm API wrapper
│ │ └── storageService.ts # Local storage management
│ ├── types/
│ │ └── api.ts # TypeScript API type definitions
│ ├── utils/
│ │ └── dateUtils.ts # Date utility functions
│ ├── App.tsx # Main application component
│ ├── index.css # Global styles
│ ├── main.tsx # React entry point
│ └── vite-env.d.ts # Vite environment types
├── .env # Environment variables (local)
├── .gitignore
├── index.html # HTML entry point
├── package.json
├── tailwind.config.js # Tailwind configuration
├── postcss.config.js # PostCSS configuration
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript configuration
├── tsconfig.app.json # App TypeScript configuration
├── tsconfig.node.json # Node TypeScript configuration
├── eslint.config.js # ESLint configuration
└── README.md
-
Create Inbox
- User clicks "Create Inbox" button
- System generates a random temporary email address using mail.tm API
- Email address is displayed and copied to clipboard
-
Receive Emails
- Real-time polling fetches incoming emails every few seconds
- Messages appear instantly in the inbox
- Each message shows sender, subject, and preview
-
View Messages
- Click on any message to view full content
- HTML emails are sanitized using DOMPurify for security
- Attachments and metadata are displayed
-
Auto-Expiry
- After 10 minutes, the inbox automatically expires
- User is notified of expiration
- All data is cleared from storage
- Old inboxes cannot receive new emails
Frontend Architecture:
- Single Page Application (SPA) with React Router-style navigation
- Component-based UI with reusable, modular components
- Centralized API service for mail.tm integration
- Custom hooks for inbox, message, and theme management
- Local storage for session persistence
- Real-time polling via React Query for email updates
Data Flow:
User Action → Component → Hook → API Service → mail.tm API → Response → State Update → UI Render
TempBox integrates with the mail.tm API:
- Domains: Fetches available email domains
- Accounts: Creates temporary email accounts
- Authentication: Issues JWT tokens for account access
- Messages: Polls for incoming emails
- Message Details: Retrieves full email content
- Cleanup: Deletes accounts and messages
- Node.js 18+ (LTS recommended)
- npm 9+ or yarn 3+
- A modern web browser
-
Clone the repository:
git clone https://github.com/ShovonSheikh/temp-box.git cd temp-box -
Install dependencies:
npm install
-
Configure environment (optional): Create a
.env.localfile if you need custom configuration:VITE_API_BASE_URL=https://api.mail.tm
-
Start development server:
npm run dev
The application will be available at http://localhost:5173
- Lint code:
npm run lint - Build for production:
npm run build - Preview production build:
npm run preview
Main interface for managing temporary inboxes. Handles account creation, email polling, and message list display.
Key Features:
- Creates new inbox on demand
- Real-time email polling with React Query
- Auto-refresh mechanism
- Loading and error states
- Message list with read/unread indicators
Displays individual email messages with full content and metadata.
Key Features:
- HTML content sanitization
- Sender and recipient information
- Email attachments (if available)
- Message timestamps
- Copy and delete actions
Modal component for displaying blog posts about privacy and email security.
Content Topics:
- Email privacy best practices
- Why temporary emails matter
- Digital security tips
- Tech behind temporary inboxes
Dark/light mode switcher that persists user preference.
Displays current session information and inbox status.
Manages inbox creation and account lifecycle.
const { account, loading, error, createInbox, deleteInbox } = useInbox();Manages message fetching and polling with React Query.
const { messages, loading, error, refetch } = useMessage(accountId, messageId);Manages dark/light mode preference and system detection.
const { isDark, toggle } = useTheme();API wrapper for mail.tm service. Handles all backend communication.
Methods:
getDomains()- Fetch available email domainscreateAccount(address, password)- Create temporary accountgetToken(address, password)- Authenticate and get JWTgetMessages(page, itemsPerPage)- Fetch inbox messagesgetMessage(messageId)- Get full message contentmarkMessageAsRead(messageId)- Mark as readdeleteMessage(messageId)- Delete messagedeleteAccount(accountId)- Delete account and cleanup
Handles authentication state and token management.
LocalStorage wrapper for session and preference persistence.
Auto-cleanup timer for expired inboxes.
- No Data Collection: No analytics, tracking cookies, or user profiling
- No Account Creation: Use without providing personal information
- Ephemeral Data: All emails and inboxes are temporary and auto-delete
- HTML Sanitization: Email content is sanitized with DOMPurify
- HTTPS Only: All API communication is encrypted
- Client-Side Processing: Data stays on your device as much as possible
- Code Splitting: Lazy-loaded components for faster initial load
- React Query Caching: Efficient data fetching with automatic caching
- Memoization: Components optimized to prevent unnecessary re-renders
- Vite Fast Refresh: Instant HMR during development
- Production Build: Optimized bundle size and tree-shaking
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
- Opera 76+
- Mobile browsers (iOS Safari 14+, Chrome Android)
Update theme colors in tailwind.config.js:
theme: {
extend: {
colors: {
primary: '#your-color',
},
},
}Modify API endpoints in src/services/mailApi.ts:
const API_BASE = 'https://your-custom-api.com';Edit blog posts in src/data/blog.ts:
export const blogPosts = [
{ id: 'post-id', title: 'Your Post', content: '...' },
];npm run buildOutput is in the dist/ folder.
- Vercel (recommended) - Optimized for Vite projects
- Netlify - Excellent serverless functions
- AWS S3 + CloudFront - Highly scalable
- GitHub Pages - Simple, free static hosting
- Self-hosted - Docker, VPS, or on-premises
VITE_API_BASE_URL=https://api.mail.tmSolution: This occurs after the 10-minute expiry. Create a new inbox to continue.
Solution: Check your email domain configuration and ensure the mail.tm service is accessible. Refresh manually or wait for the next polling interval.
Solution: Clear browser cache and localStorage, then restart the application.
Solution: Run npm run lint to identify type issues, then fix reported errors.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes with clear messages
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License. See LICENSE for details.
- mail.tm - Email API provider
- Lucide Icons - Icon library
- Tailwind CSS - Styling framework
- React Query - Data fetching library
- Vite - Build tool
- React - UI framework
For issues, feature requests, or questions:
- Open an issue on GitHub
- Check existing issues for solutions
- Review documentation and examples
TempBox – Making email privacy accessible, one temporary inbox at a time.
Built with privacy in mind. No tracking. No ads. No nonsense.