diff --git a/rest/apiv1_controller.go b/rest/apiv1_controller.go index 365b838..452600a 100644 --- a/rest/apiv1_controller.go +++ b/rest/apiv1_controller.go @@ -17,6 +17,7 @@ type JSONMessageHeaderV1 struct { Mailbox string `json:"mailbox"` ID string `json:"id"` From string `json:"from"` + To string `json:"to"` Subject string `json:"subject"` Date time.Time `json:"date"` Size int64 `json:"size"` @@ -27,6 +28,7 @@ type JSONMessageV1 struct { Mailbox string `json:"mailbox"` ID string `json:"id"` From string `json:"from"` + To string `json:"to"` Subject string `json:"subject"` Date time.Time `json:"date"` Size int64 `json:"size"` @@ -65,6 +67,7 @@ func MailboxListV1(w http.ResponseWriter, req *http.Request, ctx *httpd.Context) Mailbox: name, ID: msg.ID(), From: msg.From(), + To: msg.To(), Subject: msg.Subject(), Date: msg.Date(), Size: msg.Size(), @@ -109,6 +112,7 @@ func MailboxShowV1(w http.ResponseWriter, req *http.Request, ctx *httpd.Context) Mailbox: name, ID: msg.ID(), From: msg.From(), + To: msg.To(), Subject: msg.Subject(), Date: msg.Date(), Size: msg.Size(), diff --git a/smtpd/datastore.go b/smtpd/datastore.go index ea1256d..a483852 100644 --- a/smtpd/datastore.go +++ b/smtpd/datastore.go @@ -36,6 +36,7 @@ type Mailbox interface { type Message interface { ID() string From() string + To() string Date() time.Time Subject() string RawReader() (reader io.ReadCloser, err error) diff --git a/smtpd/filestore.go b/smtpd/filestore.go index dc46141..a17c5e1 100644 --- a/smtpd/filestore.go +++ b/smtpd/filestore.go @@ -295,6 +295,7 @@ type FileMessage struct { Fid string Fdate time.Time Ffrom string + Fto string Fsubject string Fsize int64 // These are for creating new messages only @@ -343,6 +344,13 @@ func (m *FileMessage) From() string { return m.Ffrom } + +// From returns the value of the Message From header +func (m *FileMessage) To() string { + return m.Fto +} + + // Subject returns the value of the Message Subject header func (m *FileMessage) Subject() string { return m.Fsubject @@ -486,6 +494,7 @@ func (m *FileMessage) Close() error { // Only public fields are stored in gob m.Ffrom = body.GetHeader("From") + m.Fto = body.GetHeader("To") m.Fsubject = body.GetHeader("Subject") // Refresh the index before adding our message diff --git a/themes/bootstrap/templates/mailbox/_show.html b/themes/bootstrap/templates/mailbox/_show.html index 3825e5c..ada6fd8 100644 --- a/themes/bootstrap/templates/mailbox/_show.html +++ b/themes/bootstrap/templates/mailbox/_show.html @@ -52,6 +52,8 @@