diff --git a/webapi/doc.go b/webapi/doc.go index 0b9019f..73b3e7e 100644 --- a/webapi/doc.go +++ b/webapi/doc.go @@ -238,9 +238,10 @@ Get a message in parsed form: "$notjunk", "\seen" ], - "MailFrom": "", + "MailFrom": "mox@localhost", + "RcptTo": "mox@localhost", "MailFromValidated": false, - "MsgFrom": "", + "MsgFrom": "mox@localhost", "MsgFromValidated": false, "DKIMVerifiedDomains": [], "RemoteIP": "", diff --git a/webapi/gendoc.sh b/webapi/gendoc.sh index 151995a..e7444dd 100755 --- a/webapi/gendoc.sh +++ b/webapi/gendoc.sh @@ -249,9 +249,10 @@ Get a message in parsed form: "\$notjunk", "\\seen" ], - "MailFrom": "", + "MailFrom": "mox@localhost", + "RcptTo": "mox@localhost", "MailFromValidated": false, - "MsgFrom": "", + "MsgFrom": "mox@localhost", "MsgFromValidated": false, "DKIMVerifiedDomains": [], "RemoteIP": "", diff --git a/webapi/webapi.go b/webapi/webapi.go index 823cc67..6ddf8f4 100644 --- a/webapi/webapi.go +++ b/webapi/webapi.go @@ -157,8 +157,9 @@ type MessageMeta struct { Size int64 // Total size of raw message file. DSN bool // Whether this message is a DSN. Flags []string // Standard message flags like \seen, \answered, $forwarded, $junk, $nonjunk, and custom keywords. - MailFrom string // Address used during SMTP "MAIL FROM" command. + MailFrom string // Address used during SMTP "MAIL FROM" command. Unicode. MailFromValidated bool // Whether SMTP MAIL FROM address was SPF-validated. + RcptTo string // Address delivered to with SMTP "RCPT TO" command. Unicode. MsgFrom string // Address used in message "From" header. MsgFromValidated bool // Whether address in message "From"-header was DMARC(-like) validated. DKIMVerifiedDomains []string // Verified domains from DKIM-signature in message. Can be different domain than used in addresses. diff --git a/webapisrv/server.go b/webapisrv/server.go index a1daebd..448c433 100644 --- a/webapisrv/server.go +++ b/webapisrv/server.go @@ -1245,12 +1245,17 @@ func (s server) MessageGet(ctx context.Context, req webapi.MessageGetRequest) (r if d, err := dns.ParseDomain(m.MsgFromDomain); err == nil { msgFrom = smtp.NewAddress(m.MsgFromLocalpart, d).Pack(true) } + var rcptTo string + if m.RcptToDomain != "" { + rcptTo = m.RcptToLocalpart.String() + "@" + m.RcptToDomain + } meta := webapi.MessageMeta{ Size: m.Size, DSN: m.DSN, Flags: append(m.Flags.Strings(), m.Keywords...), MailFrom: m.MailFrom, MailFromValidated: m.MailFromValidated, + RcptTo: rcptTo, MsgFrom: msgFrom, MsgFromValidated: m.MsgFromValidated, DKIMVerifiedDomains: m.DKIMDomains,