Receive email in your app

Turn incoming email into JSON your app can use: support replies, replies to notifications, documents sent to an address. Add one MX record, and every message to any address on that domain arrives at your webhook.

Start free · Receiving email in the docs

Set it up

  1. Turn on inbound for a sending domain: the switch on the domain's page in the dashboard, or PATCH /domains/:id {"inbound": true}.
  2. Add the MX record it shows (below).
  3. Create a webhook for the email.received event (webhooks).
TypeNameValue
MXinbound.notify.example.commail.trivsend.com, priority 10

Once the record is verified, mail to any address at inbound.notify.example.com is accepted: support@, invoices@ or reply+ticket-42@. Messages can be up to 25 MB.

Read a message

The email.received webhook carries who it's from, who it's to and the subject. Fetch the body and attachments with the API:

bash
curl -H "Authorization: Bearer $TRIVSEND_API_KEY" \
  https://api.trivsend.com/emails/receiving/$EMAIL_ID
json
{
  "object": "email",
  "from": "Asha <asha@example.org>",
  "to": ["reply+ticket-42@inbound.notify.example.com"],
  "subject": "Re: Ticket 42",
  "rcpt_to": ["reply+ticket-42@inbound.notify.example.com"],
  "text": "Thanks, that fixed it.",
  "html": "<div>Thanks, that fixed it.</div>",
  "headers": { "in-reply-to": "<...>" },
  "attachments": [
    { "id": "...", "filename": "screenshot.png", "content_type": "image/png", "size": 48213 }
  ]
}

Download an attachment with GET /emails/receiving/:id/attachments/:attachmentId (the content is base64), and list everything received with GET /emails/receiving.

Route replies to the right record

Send your notification with a reply address that names the record:

js
await trivsend.emails.send({
  from: "Acme Support <support@notify.example.com>",
  to: customer.email,
  reply_to: `reply+ticket-${ticket.id}@inbound.notify.example.com`,
  subject: `Ticket ${ticket.id}: we've replied`,
  text: reply,
});

When the customer answers, read the part after + from rcpt_to and attach the message to ticket 42. No mailbox to poll, no IMAP passwords to store.

What people build with it

Inbound is included in every plan, on the same domain and account you send from. Webhooks are signed, retried and can be replayed (webhooks). Free for 3,000 emails a month (pricing).

Also see: Email webhooks · Transactional email · Email API for India