mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
add "RcptTo" to webapi MessageGet result
otherwise, if the recipient was a bcc, there's no good way to see why the message was received. incoming webhooks already have this rcptto field, but that's not always the moment you want to process it. for mattanja on matrix, thanks for reporting!
This commit is contained in:
parent
a7bdc41cd4
commit
b0c4b09010
4 changed files with 13 additions and 5 deletions
|
@ -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": "",
|
||||
|
|
|
@ -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": "",
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue