mirror of
https://github.com/axllent/mailpit.git
synced 2025-07-17 01:32:33 +02:00
API: Include Return-Path in message summary data
This commit is contained in:
@ -404,6 +404,11 @@ func GetMessage(id string) (*Message, error) {
|
|||||||
from = &mail.Address{Name: env.GetHeader("From")}
|
from = &mail.Address{Name: env.GetHeader("From")}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
returnPath := strings.Trim(env.GetHeader("Return-Path"), "<>")
|
||||||
|
if returnPath == "" {
|
||||||
|
returnPath = from.Address
|
||||||
|
}
|
||||||
|
|
||||||
date, err := env.Date()
|
date, err := env.Date()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// return received datetime when message does not contain a date header
|
// return received datetime when message does not contain a date header
|
||||||
@ -443,6 +448,7 @@ func GetMessage(id string) (*Message, error) {
|
|||||||
Cc: addressToSlice(env, "Cc"),
|
Cc: addressToSlice(env, "Cc"),
|
||||||
Bcc: addressToSlice(env, "Bcc"),
|
Bcc: addressToSlice(env, "Bcc"),
|
||||||
ReplyTo: addressToSlice(env, "Reply-To"),
|
ReplyTo: addressToSlice(env, "Reply-To"),
|
||||||
|
ReturnPath: returnPath,
|
||||||
Subject: env.GetHeader("Subject"),
|
Subject: env.GetHeader("Subject"),
|
||||||
Tags: getMessageTags(id),
|
Tags: getMessageTags(id),
|
||||||
Size: len(raw),
|
Size: len(raw),
|
||||||
|
@ -25,6 +25,8 @@ type Message struct {
|
|||||||
Bcc []*mail.Address
|
Bcc []*mail.Address
|
||||||
// ReplyTo addresses
|
// ReplyTo addresses
|
||||||
ReplyTo []*mail.Address
|
ReplyTo []*mail.Address
|
||||||
|
// ReturnPath is the Return-Path
|
||||||
|
ReturnPath string
|
||||||
// Message subject
|
// Message subject
|
||||||
Subject string
|
Subject string
|
||||||
// Message date if set, else date received
|
// Message date if set, else date received
|
||||||
|
Reference in New Issue
Block a user