Email is still how many businesses receive orders, invoices, support requests and replies. Turning that email into structured data automatically saves hours of manual work. This guide covers receiving, parsing and processing email reliably on your own server, and sending replies that reach inboxes.
Receiving Email
| Method | How it works | Best for |
|---|---|---|
| Inbound email provider | Provider receives mail for a subdomain and POSTs parsed or raw messages to your webhook | Most applications; no mail server to run |
| IMAP polling | Your worker logs into existing mailboxes and fetches new messages | Processing an existing business mailbox |
| Own mail server (MX) | Postfix or similar receives mail and pipes it to your app | Special needs and experienced teams |
For Google Workspace and Microsoft 365 mailboxes, use OAuth-based access through their APIs or IMAP with OAuth, as basic password authentication is restricted.
Store First, Process Later
Save every raw message (or the provider's payload) with a unique ID before processing. Then a parsing bug can be fixed and messages reprocessed, and duplicates from retries are ignored. Process in background workers (see our workers guide), and for webhook delivery follow the verify-store-acknowledge pattern (see our webhook guide).
Parsing Email Safely
- Use a mature MIME parsing library; email formats are full of edge cases.
- Prefer the plain-text part; sanitise HTML before displaying it anywhere.
- Strip quoted replies and signatures when threading conversations.
- Use
Message-ID,In-Reply-ToandReferencesheaders (or a unique reply address) to attach replies to the right ticket or thread. - Handle character encodings properly, including Indian languages.
Attachments
- Limit size and allowed types.
- Scan for malware (for example with ClamAV) before storing or opening.
- Store attachments privately and serve them only after access checks.
- Extract data in workers: PDF text, OCR for scanned invoices, spreadsheet parsing (see our file processing guide).
Common Use Cases
- Email to ticket: new emails create support tickets; replies append to them.
- Invoice ingestion: supplier invoices arrive by email; attachments are parsed and queued for approval.
- Order intake: purchase orders from customers are parsed into draft orders.
- Bounce and reply handling for campaigns and notifications.
Spam and Abuse
Public inbound addresses attract spam. Use the provider's spam scores or SpamAssassin/Rspamd results, verify sender authentication (SPF, DKIM, DMARC results) for sensitive workflows such as invoice processing, and never act automatically on high-risk requests (payment changes, bank details) based on email alone.
Sending Replies
Send through a transactional email service with SPF, DKIM and DMARC configured for your domain, use consistent From addresses, include proper threading headers in replies, and process bounces to suppress bad addresses (see our notification service guide).
Storage and Privacy
Emails contain personal and business data. Encrypt backups, restrict access to stored messages, define retention periods and delete old messages accordingly, and avoid logging message bodies.
Sizing
| Workload | Suggested plan |
|---|---|
| Ticketing or invoice intake, thousands of emails per day | 2 vCores / 8 GB |
| OCR, attachment conversion, high volume | 4 vCores / 16 GB or more |
Plan disk for stored messages and attachments, or move them to object storage.
Common Mistakes
- Processing in the webhook request and losing messages on errors.
- Parsing email with regular expressions instead of a MIME library.
- Opening attachments without scanning.
- Trusting email requests to change payment details.
In Short
Receive through a provider or IMAP, store raw messages first, parse with proper libraries in workers, scan attachments, authenticate outgoing mail and protect stored data.
Example: Invoice Intake for a Finance Team
A distribution company asks suppliers to email invoices to a dedicated address on a subdomain handled by an inbound email provider. Each message is posted to a webhook on the company's VPS, stored raw, and queued. A worker checks SPF and DKIM results, scans attachments with ClamAV, extracts text from PDFs (running OCR for scanned ones), and matches supplier, invoice number and amount against purchase orders. Matched invoices go to an approval queue; anything unusual, such as changed bank details, is flagged for a person to review. The finance team now spends its time on exceptions rather than data entry.
Monitoring the Pipeline
Track messages received per hour, processing queue depth, parsing failures, attachment scan results and time from arrival to processed. Alert when no email has arrived for longer than usual (a broken MX record or expired webhook can silently stop intake) and when failures rise. Keep a simple screen where staff can see a message's raw content and processing history.
Next Steps
Choose between an inbound provider and IMAP polling, build the store-first webhook or poller, add parsing and attachment scanning, and test with real samples of the messages you expect.
A Typical Pipeline
inbound provider / IMAP ─▶ store raw message ─▶ queue
worker: parse MIME ─▶ scan attachments ─▶ classify
─▶ create ticket / invoice draft / order ─▶ notify team
Each step records status, so a message that fails at classification can be retried from that point without fetching it again.
IMAP Polling Tips
- Track the last processed UID per folder rather than relying on read flags, which people change.
- Move processed messages to a separate folder so the inbox stays small and the state is visible.
- Poll at a sensible interval or use IDLE where supported, and reconnect gracefully after network errors.
- Store OAuth refresh tokens securely and alert when authorisation expires.
Example: Supplier Invoice Intake
A distributor asks suppliers to email invoices to a dedicated address. An inbound provider posts each message to a webhook on a 2 vCore / 8 GB VPS, which stores the payload and queues it. Workers scan attachments with ClamAV, extract PDF text, run OCR on scanned invoices, match the supplier by sender domain and GSTIN, and create draft entries for the accounts team to approve. Any request to change bank details is flagged for phone verification instead of being processed automatically.
Monitoring
Track messages received, parsed and failed per hour, queue backlog, attachment scan results and IMAP connection errors, and alert when no email arrives during business hours, which usually means a broken route.
SkyRainCloud Plans for This Workload
Email processing is mostly I/O and parsing: 2 vCores / 8 GB handles thousands of messages an hour. Add vCores for OCR or attachment conversion, and storage for retained messages.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Intel Xeon Platinum 8269CY VPS
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.