1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-07-13 01:20:22 +02:00

API: Include Reply-To in message summary (including Web UI)

This adds a new ReplyTo array to to API Message response, and displays in the web UI if set. See #66
This commit is contained in:
Ralph Slooten
2023-03-31 23:34:59 +13:00
parent 4e6d8e5803
commit f16b105d26
5 changed files with 30 additions and 9 deletions

View File

@ -28,6 +28,7 @@ Returns a JSON summary of the message and attachments.
], ],
"Cc": [], "Cc": [],
"Bcc": [], "Bcc": [],
"ReplyTo": [],
"Subject": "Message subject", "Subject": "Message subject",
"Date": "2016-09-07T16:46:00+13:00", "Date": "2016-09-07T16:46:00+13:00",
"Text": "Plain text MIME part of the email", "Text": "Plain text MIME part of the email",
@ -57,7 +58,7 @@ Returns a JSON summary of the message and attachments.
- `Read` - always true (message marked read on open) - `Read` - always true (message marked read on open)
- `From` - Name & Address, or null - `From` - Name & Address, or null
- `To`, `CC`, `BCC` - Array of Names & Address - `To`, `CC`, `BCC`, `ReplyTo` - Array of Names & Address
- `Date` - Parsed email local date & time from headers - `Date` - Parsed email local date & time from headers
- `Size` - Total size of raw email - `Size` - Total size of raw email
- `Inline`, `Attachments` - Array of attachments and inline images. - `Inline`, `Attachments` - Array of attachments and inline images.

View File

@ -147,12 +147,14 @@ export default {
<div class="col-md"> <div class="col-md">
<table class="messageHeaders"> <table class="messageHeaders">
<tbody> <tbody>
<tr class="small"> <tr>
<th>From</th> <th class="small">From</th>
<td class="privacy"> <td class="privacy">
<span v-if="message.From"> <span v-if="message.From">
<span v-if="message.From.Name">{{ message.From.Name + " " }}</span> <span v-if="message.From.Name">{{ message.From.Name + " " }}</span>
<span v-if="message.From.Address">&lt;{{ message.From.Address }}&gt;</span> <span v-if="message.From.Address" class="small">
&lt;{{ message.From.Address }}&gt;
</span>
</span> </span>
<span v-else> <span v-else>
[ Unknown ] [ Unknown ]
@ -164,9 +166,9 @@ export default {
<td class="privacy"> <td class="privacy">
<span v-if="message.To && message.To.length" v-for="(t, i) in message.To"> <span v-if="message.To && message.To.length" v-for="(t, i) in message.To">
<template v-if="i > 0">, </template> <template v-if="i > 0">, </template>
<span class="text-nowrap">{{ t.Name + " <" + t.Address + ">" }}</span> <span class="text-nowrap">{{ t.Name + " &lt;" + t.Address + "&gt;" }}</span>
</span> </span>
<span v-else>Undisclosed recipients</span> <span v-else>Undisclosed recipients</span>
</td> </td>
</tr> </tr>
<tr v-if="message.Cc && message.Cc.length" class="small"> <tr v-if="message.Cc && message.Cc.length" class="small">
@ -174,7 +176,7 @@ export default {
<td class="privacy"> <td class="privacy">
<span v-for="(t, i) in message.Cc"> <span v-for="(t, i) in message.Cc">
<template v-if="i > 0">,</template> <template v-if="i > 0">,</template>
{{ t.Name + " <" + t.Address + ">" }} </span> {{ t.Name + " &lt;" + t.Address + "&gt;" }} </span>
</td> </td>
</tr> </tr>
<tr v-if="message.Bcc && message.Bcc.length" class="small"> <tr v-if="message.Bcc && message.Bcc.length" class="small">
@ -182,7 +184,15 @@ export default {
<td class="privacy"> <td class="privacy">
<span v-for="(t, i) in message.Bcc"> <span v-for="(t, i) in message.Bcc">
<template v-if="i > 0">,</template> <template v-if="i > 0">,</template>
{{ t.Name + " <" + t.Address + ">" }} </span> {{ t.Name + " &lt;" + t.Address + "&gt;" }} </span>
</td>
</tr>
<tr v-if="message.ReplyTo && message.ReplyTo.length" class="small">
<th class="text-nowrap">Reply-To</th>
<td class="privacy text-muted">
<span v-for="(t, i) in message.ReplyTo">
<template v-if="i > 0">,</template>
{{ t.Name + " &lt;" + t.Address + "&gt;" }} </span>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -586,6 +586,13 @@
"description": "Read status", "description": "Read status",
"type": "boolean" "type": "boolean"
}, },
"ReplyTo": {
"description": "ReplyTo addresses",
"type": "array",
"items": {
"$ref": "#/definitions/Address"
}
},
"Size": { "Size": {
"description": "Message size in bytes", "description": "Message size in bytes",
"type": "integer", "type": "integer",

View File

@ -442,6 +442,7 @@ func GetMessage(id string) (*Message, error) {
To: addressToSlice(env, "To"), To: addressToSlice(env, "To"),
Cc: addressToSlice(env, "Cc"), Cc: addressToSlice(env, "Cc"),
Bcc: addressToSlice(env, "Bcc"), Bcc: addressToSlice(env, "Bcc"),
ReplyTo: addressToSlice(env, "Reply-To"),
Subject: env.GetHeader("Subject"), Subject: env.GetHeader("Subject"),
Tags: getMessageTags(id), Tags: getMessageTags(id),
Size: len(raw), Size: len(raw),

View File

@ -23,6 +23,8 @@ type Message struct {
Cc []*mail.Address Cc []*mail.Address
// Bcc addresses // Bcc addresses
Bcc []*mail.Address Bcc []*mail.Address
// ReplyTo addresses
ReplyTo []*mail.Address
// Message subject // Message subject
Subject string Subject string
// Message date if set, else date received // Message date if set, else date received