mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 18:17: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"`
|
Mailbox string `json:"mailbox"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
From string `json:"from"`
|
From string `json:"from"`
|
||||||
|
To string `json:"to"`
|
||||||
Subject string `json:"subject"`
|
Subject string `json:"subject"`
|
||||||
Date time.Time `json:"date"`
|
Date time.Time `json:"date"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
@@ -27,6 +28,7 @@ type JSONMessageV1 struct {
|
|||||||
Mailbox string `json:"mailbox"`
|
Mailbox string `json:"mailbox"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
From string `json:"from"`
|
From string `json:"from"`
|
||||||
|
To string `json:"to"`
|
||||||
Subject string `json:"subject"`
|
Subject string `json:"subject"`
|
||||||
Date time.Time `json:"date"`
|
Date time.Time `json:"date"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
@@ -65,6 +67,7 @@ func MailboxListV1(w http.ResponseWriter, req *http.Request, ctx *httpd.Context)
|
|||||||
Mailbox: name,
|
Mailbox: name,
|
||||||
ID: msg.ID(),
|
ID: msg.ID(),
|
||||||
From: msg.From(),
|
From: msg.From(),
|
||||||
|
To: msg.To(),
|
||||||
Subject: msg.Subject(),
|
Subject: msg.Subject(),
|
||||||
Date: msg.Date(),
|
Date: msg.Date(),
|
||||||
Size: msg.Size(),
|
Size: msg.Size(),
|
||||||
@@ -109,6 +112,7 @@ func MailboxShowV1(w http.ResponseWriter, req *http.Request, ctx *httpd.Context)
|
|||||||
Mailbox: name,
|
Mailbox: name,
|
||||||
ID: msg.ID(),
|
ID: msg.ID(),
|
||||||
From: msg.From(),
|
From: msg.From(),
|
||||||
|
To: msg.To(),
|
||||||
Subject: msg.Subject(),
|
Subject: msg.Subject(),
|
||||||
Date: msg.Date(),
|
Date: msg.Date(),
|
||||||
Size: msg.Size(),
|
Size: msg.Size(),
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ type Mailbox interface {
|
|||||||
type Message interface {
|
type Message interface {
|
||||||
ID() string
|
ID() string
|
||||||
From() string
|
From() string
|
||||||
|
To() string
|
||||||
Date() time.Time
|
Date() time.Time
|
||||||
Subject() string
|
Subject() string
|
||||||
RawReader() (reader io.ReadCloser, err error)
|
RawReader() (reader io.ReadCloser, err error)
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ type FileMessage struct {
|
|||||||
Fid string
|
Fid string
|
||||||
Fdate time.Time
|
Fdate time.Time
|
||||||
Ffrom string
|
Ffrom string
|
||||||
|
Fto string
|
||||||
Fsubject string
|
Fsubject string
|
||||||
Fsize int64
|
Fsize int64
|
||||||
// These are for creating new messages only
|
// These are for creating new messages only
|
||||||
@@ -343,6 +344,13 @@ func (m *FileMessage) From() string {
|
|||||||
return m.Ffrom
|
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
|
// Subject returns the value of the Message Subject header
|
||||||
func (m *FileMessage) Subject() string {
|
func (m *FileMessage) Subject() string {
|
||||||
return m.Fsubject
|
return m.Fsubject
|
||||||
@@ -486,6 +494,7 @@ func (m *FileMessage) Close() error {
|
|||||||
|
|
||||||
// Only public fields are stored in gob
|
// Only public fields are stored in gob
|
||||||
m.Ffrom = body.GetHeader("From")
|
m.Ffrom = body.GetHeader("From")
|
||||||
|
m.Fto = body.GetHeader("To")
|
||||||
m.Fsubject = body.GetHeader("Subject")
|
m.Fsubject = body.GetHeader("Subject")
|
||||||
|
|
||||||
// Refresh the index before adding our message
|
// Refresh the index before adding our message
|
||||||
|
|||||||
@@ -52,6 +52,8 @@
|
|||||||
<dl class="dl-horizontal">
|
<dl class="dl-horizontal">
|
||||||
<dt>From:</dt>
|
<dt>From:</dt>
|
||||||
<dd>{{.message.From}}</dd>
|
<dd>{{.message.From}}</dd>
|
||||||
|
<dt>To:</dt>
|
||||||
|
<dd>{{.message.To}}</dd>
|
||||||
<dt>Date:</dt>
|
<dt>Date:</dt>
|
||||||
<dd>{{.message.Date}}</dd>
|
<dd>{{.message.Date}}</dd>
|
||||||
<dt>Subject:</dt>
|
<dt>Subject:</dt>
|
||||||
|
|||||||
@@ -13,6 +13,10 @@
|
|||||||
<th>From:</th>
|
<th>From:</th>
|
||||||
<td>{{.message.From}}</td>
|
<td>{{.message.From}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>To:</th>
|
||||||
|
<td>{{.message.To}}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Date:</th>
|
<th>Date:</th>
|
||||||
<td>{{.message.Date}}</td>
|
<td>{{.message.Date}}</td>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ type JSONMessageHeader struct {
|
|||||||
Mailbox string
|
Mailbox string
|
||||||
ID string `json:"Id"`
|
ID string `json:"Id"`
|
||||||
From string
|
From string
|
||||||
|
To string
|
||||||
Subject string
|
Subject string
|
||||||
Date time.Time
|
Date time.Time
|
||||||
Size int64
|
Size int64
|
||||||
@@ -29,6 +30,7 @@ type JSONMessage struct {
|
|||||||
Mailbox string
|
Mailbox string
|
||||||
ID string `json:"Id"`
|
ID string `json:"Id"`
|
||||||
From string
|
From string
|
||||||
|
To string
|
||||||
Subject string
|
Subject string
|
||||||
Date time.Time
|
Date time.Time
|
||||||
Size int64
|
Size int64
|
||||||
@@ -113,6 +115,7 @@ func MailboxList(w http.ResponseWriter, req *http.Request, ctx *httpd.Context) (
|
|||||||
Mailbox: name,
|
Mailbox: name,
|
||||||
ID: msg.ID(),
|
ID: msg.ID(),
|
||||||
From: msg.From(),
|
From: msg.From(),
|
||||||
|
To: msg.To(),
|
||||||
Subject: msg.Subject(),
|
Subject: msg.Subject(),
|
||||||
Date: msg.Date(),
|
Date: msg.Date(),
|
||||||
Size: msg.Size(),
|
Size: msg.Size(),
|
||||||
|
|||||||
Reference in New Issue
Block a user