Karta. Inbound. Formats. Mailgun
(Karta v1.0.0)
A Mailgun route's forward() post: the fields Mailgun sends to a
destination URL when a route forwards a received message, so an
application written for Mailgun's inbound parsing takes Karta's post
unchanged.
The base fields are subject, sender (the envelope sender), from
(the From field), recipient (the delivery's address as RCPT TO named
it) and message-headers (every header field, in order, as a JSON array
of [name, value] pairs). Mailgun's stripped-text, stripped-html and
stripped-signature (the body without its quoted reply) are not sent:
Mailgun leaves them out when it cannot parse a reply, and Karta does not
parse one.
encoding is Mailgun's own choice by destination URL:
:form- form data withbody-plainandbody-html(as a list, as Mailgun sends it), and the attachments asattachment-countandattachment-<n>file parts of amultipart/form-databody (plain form data when there are none);:mime- form data with the whole message asbody-mimeinstead of the bodies and the attachments (the URL ending inmime), which is what an Action Mailbox Mailgun ingress needs;:json- one JSON document withmessage-headersas a native array andattachmentsas a list of{filename, content-type, content}(base64).
Signature. timestamp (seconds) and a random 50-character token
are signed with the endpoint's secret, as Mailgun signs:
signature = HMAC-SHA256(secret, timestamp <> token), hex. In the form
encodings they are fields; in JSON they are the headers
X-Mailgun-Signature (over the whole body) and X-Mailgun-Timestamp.
The secret is shown once when the endpoint is added; it is the signing
key a receiver verifies with.
Summary
Functions
The request's headers and body.
Functions
@spec build( Karta.Inbound.Endpoint.t(), Karta.Inbound.Delivery.t(), Karta.Messages.Message.t(), binary(), Karta.Inbound.MailFields.t(), DateTime.t() ) :: {[{String.t(), String.t()}], binary()}
The request's headers and body.