This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: bryon (git@mail.blmayer.dev)
Date: Thu Jul 20 21:13:43 2023 -0300
Parent: c18a936
Added mode templates
commit ea1e16e052c466fabcbd062eebbb24ed96a00e84
Author: bryon <git@mail.blmayer.dev>
Date: Thu Jul 20 21:13:43 2023 -0300
Added mode templates
diff --git a/model/html/html.go b/model/html/html.go
index b6bd6e0..a68c234 100644
--- a/model/html/html.go
+++ b/model/html/html.go
@@ -36,6 +36,7 @@ type HTMLHandler struct {
privateKey string
indexTpl *template.Template
listTpl *template.Template
+ mailsTpl *template.Template
mailTpl *template.Template
}
@@ -47,6 +48,18 @@ func NewHTMLHandler(c model.HTMLConfig) (HTMLHandler, error) {
if err != nil {
return f, err
}
+ f.mailsTpl, err = template.ParseFiles(c.MailsTpl)
+ if err != nil {
+ return f, err
+ }
+ f.listTpl, err = template.ParseFiles(c.ListTpl)
+ if err != nil {
+ return f, err
+ }
+ f.indexTpl, err = template.ParseFiles(c.IndexTpl)
+ if err != nil {
+ return f, err
+ }
if c.PrivateKey != "" {
key, err := ioutil.ReadFile(c.PrivateKey)
@@ -137,28 +150,3 @@ func (h HTMLHandler) Save(from, to string, r io.Reader) error {
// TODO: Update index and lists
}
-func (f HTMLHandler) Mailboxes(folder string) ([]model.Mailbox, error) {
- return nil, nil
-}
-
-func (f HTMLHandler) Mails(folder string) ([]model.Email, error) {
- return nil, nil
-}
-
-func (f HTMLHandler) Mail(file string) (model.Email, error) {
- return model.Email{}, nil
-}
-
-// Move is used to move messages between folders. The id parameter
-// is the message id to be moved and to is the destination folder.
-// Root is added automatically.
-func (f HTMLHandler) Move(id, to string) error {
- return nil
-}
-
-// Delete is used to delete messages. The id parameter
-// is the message id to be deleted.
-// Root is added automatically.
-func (f HTMLHandler) Delete(id string) error {
- return nil
-}
commit ea1e16e052c466fabcbd062eebbb24ed96a00e84
Author: bryon <git@mail.blmayer.dev>
Date: Thu Jul 20 21:13:43 2023 -0300
Added mode templates
diff --git a/model/main.go b/model/main.go
index 595ebac..9d0c241 100644
--- a/model/main.go
+++ b/model/main.go
@@ -50,6 +50,7 @@ type HTMLConfig struct {
CommonConfig
IndexTpl string
ListTpl string
+ MailsTpl string
MailTpl string
}