mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
Added "To:" header
This commit is contained in:
committed by
James Hillyerd
parent
1856deae46
commit
124f830478
@@ -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(),
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
<dl class="dl-horizontal">
|
||||
<dt>From:</dt>
|
||||
<dd>{{.message.From}}</dd>
|
||||
<dt>To:</dt>
|
||||
<dd>{{.message.To}}</dd>
|
||||
<dt>Date:</dt>
|
||||
<dd>{{.message.Date}}</dd>
|
||||
<dt>Subject:</dt>
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
<th>From:</th>
|
||||
<td>{{.message.From}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>To:</th>
|
||||
<td>{{.message.To}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date:</th>
|
||||
<td>{{.message.Date}}</td>
|
||||
|
||||
@@ -19,6 +19,7 @@ type JSONMessageHeader struct {
|
||||
Mailbox string
|
||||
ID string `json:"Id"`
|
||||
From string
|
||||
To string
|
||||
Subject string
|
||||
Date time.Time
|
||||
Size int64
|
||||
@@ -29,6 +30,7 @@ type JSONMessage struct {
|
||||
Mailbox string
|
||||
ID string `json:"Id"`
|
||||
From string
|
||||
To string
|
||||
Subject string
|
||||
Date time.Time
|
||||
Size int64
|
||||
@@ -113,6 +115,7 @@ func MailboxList(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(),
|
||||
|
||||
Reference in New Issue
Block a user