1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-01-16 02:47:11 +02:00

API: Include Return-Path in message summary data

This commit is contained in:
Ralph Slooten 2023-04-21 11:44:34 +12:00
parent b5b0c173c3
commit 6a82dd0eb2
2 changed files with 20 additions and 12 deletions

View File

@ -404,6 +404,11 @@ func GetMessage(id string) (*Message, error) {
from = &mail.Address{Name: env.GetHeader("From")}
}
returnPath := strings.Trim(env.GetHeader("Return-Path"), "<>")
if returnPath == "" {
returnPath = from.Address
}
date, err := env.Date()
if err != nil {
// 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"),
Bcc: addressToSlice(env, "Bcc"),
ReplyTo: addressToSlice(env, "Reply-To"),
ReturnPath: returnPath,
Subject: env.GetHeader("Subject"),
Tags: getMessageTags(id),
Size: len(raw),

View File

@ -25,6 +25,8 @@ type Message struct {
Bcc []*mail.Address
// ReplyTo addresses
ReplyTo []*mail.Address
// ReturnPath is the Return-Path
ReturnPath string
// Message subject
Subject string
// Message date if set, else date received