mail-fu

🚧🚧 Aaaah sry... not finished with this one yet! 🚧🚧

In a nutshell:

You can send emails to whatever-mailbox-you-want@pbedat.de And receive them with server-sent events.

Check it out:

Send an email to hello-mail-fu@pbedat.de

Or stream it yourself:
curl -LN https://mail-fu.pbedat.de/api/hello-mail-fu/events

What is it doing?

mail-fu is really super simple: The endpoint https://mail-fu.pbedat.de/api/:mailbox/events gives you a text/event-stream of server-sent events.

Sending an email to this :mailbox publishes the email to the event stream. The email never ever touches a disk or any other persistent storage and is completely ephemeral.

Using your own domain

If you want to stream emails from your own domain, you have to create a MX entry:

your-domain.com.   MX  10 mail.pbedat.de

The value of the MX entry is 10 mail.pbedat.de where 10 is just a convenient value for the priority (only important if you are using more than one mailserver).

Now in order to stream from e.g. foo@your-domain.com, you have to change the request url a little bit:

https://mail-fu.pbedat.de/api/your-domain.com/:mailbox/events 

And thats it!

Reference

Stream URL

https://mail-fu.pbedat.de/api/:domain/:mailbox/events

Calling this URL results in a event stream of emails sent to :mailbox@:domain

The :domain param is optional. The request will redirect to the url with the default domain pbedat.de

Types

The streamed mails have the following properties - taken from the awesome https://nodemailer.com/extras/mailparser/

Mail

Property Type Description
headers object a Map object with lowercase header keys
subject string subject is the subject line
from Address from is an address object for the From: header
to Address to is an address object for the To: header
cc Address cc is an address object for the Cc: header
bcc Address bcc is an address object for the Bcc: header (usually not present)
date Date date is a Date object for the Date: header
messageId string the Message-ID value string
inReplyTo string the In-Reply-To value string
reply-to Address reply-to is an address object for the Cc: header
references string[] references is an array of referenced Message-ID values
html string html is the HTML body of the message. If the message included embedded images as cid: urls then these are all replaced with base64 formatted data: URIs
text string the plaintext body of the message
textAsHtml string the plaintext body of the message formatted as HTML
attachments Attachment[] attachments is an array of attachments

Address

Property Type Description
value Array<{name: string, address: string, group: string[]}>

an array with address details

  • name is the name part of the email/group
  • address is the email address
  • group is an array of grouped addresses
text string formatted address string for plaintext context
html string formatted address string for HTML context

Example:

{
  value: [
      {
          address: 'andris+123@kreata.ee',
          name: 'Andris Reinman'
      },
      {
          address: 'andris.reinman@gmail.com',
          name: ''
      }
  ],
  html: '<span class="mp_address_name">Andris Reinman</span> <<a href="mailto:andris+123@kreata.ee" class="mp_address_email">andris+123@kreata.ee</a>>, <a href="mailto:andris.reinman@gmail.com" class="mp_address_email">andris.reinman@gmail.com</a>',
  text: 'Andris Reinman <andris+123@kreata.ee>, andris.reinman@gmail.com'
}

Attachment

Property Type Description
filename string (if available) file name of the attachment
contentType string MIME type of the message
contentDisposition string content disposition type for the attachment, most probably “attachment”
checksum string a MD5 hash of the message content
size number message size in bytes
headers object a Map value that holds MIME headers for the attachment node
content string a base64 string that contains the attachment contents
contentId string the header value from ‘Content-ID’ (if present)
cid string contentId without < and >
related boolean if true then this attachment should not be offered for download (at least not in the main attachments list)
Made with 💖 by @pbedat