# Source: https://documentation.mailgun.com/docs/mailgun/user-manual/receive-forward-store/store-retreive.md

# Storing and Retrieving Messages

When storing an email through a store() action in a Route, you can choose to be notified when the message is stored by including a URL with the notify parameter when setting up the store action or you can retrieve the message later by searching for the message through the [Logs API](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/logs/post-v1-analytics-logs) and retrieving it through the [Messages API](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/messages/get-v3-domains--domain-name--messages--storage-key-).

When you set a URL to be posted when the message is received:

(store(notify="http://mydomain.com/callback") or retrieve the message later through a GET request to the Messages API, the following parameters are posted/returned in JSON.

If at least one attachment is written, then the resulting body will have a multipart/form-data content type, otherwise it will have an application/x-www-form-urlencoded content type.

| **Parameter** | **Type** | **Description** |
|  --- | --- | --- |
| `domain` | String | The domain name this message was received from. |
| `recipient` | string | The recipient of the message as reported by MAIL TO during SMTP chat |
| `sender` | string | The sender of the message as reported by MAIL FROM during SMTP chat. *(This value may differ from the MIME header)* |
| `from` | string | The sender of the message as reported by from message header, for example "Bob Lee <blee@mailgun.net>". |
| `subject` | string | The subject string |
| `body-plain` | string | The text version of the email. This field is always present. If the incoming message only has HTML body, Mailgun will create a text representation for you. |
| `stripped-text` | string | The text version of the message without the quoted parts and signature block (if found) |
| `stripped-signature` | string | The signature block stripped from the plain text message (if found) |
| `body-html` | string | The HTML version of the message, if message was multipart. Note that all parts of the message will be posted, not just text/html. For instance, if a message arrives with "foo" part it will be posted as "body-foo" |
| `stripped-html` | string | The HTML version of the message, without the quoted parts |
| `attachments` | string | The string that contains a JSON list of metadata objects, one for each attachment. |
| `message-url` | string | A URL that you can use to get and/or delete the message. Only present in the payload posted to the notification URL |
| `timestamp` | int | The number of seconds passed since January 1, 1970 *(See Securing Webhooks)* |
| `token` | string | A randomly generated string with a length of 50 *(See Securing Webhooks)* |
| `signature` | string | A string with hexadecimal digits generated by HMAC algorithm *(See securing webhooks)*. |
| `message-headers` | string | A list of MIME headers dumped to a JSON string (The o_rder of headers is preserved)_ |
| `Content-id-map` | string |  |


Alternatively, you can choose the following parameters when the Accept header is set to message/rfc2822

| Parameter | type | Description |
|  --- | --- | --- |
| `recipient` | string | The recipient of the message |
| `sender` | string | The sender of the message |
| `from` | string | The sender of the message as reported by the from message header. Example: <bob@example.com>" |
| `subject` | string | The subject string |
| `Body-mime | string | The Full MIME envelope. You will need a MIME parsing library to process this data |