This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: blmayer (bleemayer@gmail.com)
Date: Thu Apr 20 03:07:17 2023 -0300
Parent: cdf7299
Small style improvements - No longer using one screen to display emails
commit 2007e86d8554a354757cbc360eb6fb882bc1f646
Author: blmayer <bleemayer@gmail.com>
Date: Thu Apr 20 03:07:17 2023 -0300
Small style improvements
- No longer using one screen to display emails
diff --git a/interfaces/file/file.go b/interfaces/file/file.go
index ed450c8..31e5be2 100644
--- a/interfaces/file/file.go
+++ b/interfaces/file/file.go
@@ -344,6 +344,12 @@ func (f FileHandler) Mails(folder string) ([]interfaces.Email, error) {
emails = append(emails, mail)
}
+ sort.Slice(
+ emails,
+ func(i, j int) bool {
+ return emails[i].Date.Before(emails[j].Date)
+ },
+ )
fmt.Println("found", len(emails), "emails")
return emails, err
commit 2007e86d8554a354757cbc360eb6fb882bc1f646
Author: blmayer <bleemayer@gmail.com>
Date: Thu Apr 20 03:07:17 2023 -0300
Small style improvements
- No longer using one screen to display emails
diff --git a/parse_test.go b/parse_test.go
index a1d8dc3..062464e 100644
--- a/parse_test.go
+++ b/parse_test.go
@@ -3,21 +3,26 @@ package dovel
import (
"testing"
+ "blmayer.dev/x/dovel/config"
"blmayer.dev/x/dovel/interfaces/file"
)
func TestParseMail(t *testing.T) {
- h, err := file.NewFileHandler(file.FileConfig{}, nil)
+ h, err := file.NewFileHandler(config.InboxConfig{}, nil, nil)
if err != nil {
t.Error(err)
return
}
mail, err := h.Mail(
- "mail/google@mail.blmayer.dev/Email verification code: 299495/0000000000006dc23005f4143c1f@google.com",
+ "mail/test/attachment/base64.txt",
)
if err != nil {
t.Error(err)
}
+ if len(mail.Attachments) == 0 {
+ t.Error("attachment not parsed")
+ }
+
t.Log(mail)
}
commit 2007e86d8554a354757cbc360eb6fb882bc1f646
Author: blmayer <bleemayer@gmail.com>
Date: Thu Apr 20 03:07:17 2023 -0300
Small style improvements
- No longer using one screen to display emails
diff --git a/www/index.html b/www/index.html
index 0af2910..5521891 100644
--- a/www/index.html
+++ b/www/index.html
@@ -6,7 +6,16 @@
<link rel="apple-touch-icon" sizes="200x200" href="/logo.png">
</head>
<body>
+ <center>
+<pre>
+_________ ______
+______ /________ _________ /
+_ __ /_ __ \_ | / / _ \_ /
+/ /_/ / / /_/ /_ |/ // __/ /
+\__,_/ \____/_____/ \___//_/
+</pre>
+ </center>
<b>inboxes!</b><br>
<br>
commit 2007e86d8554a354757cbc360eb6fb882bc1f646
Author: blmayer <bleemayer@gmail.com>
Date: Thu Apr 20 03:07:17 2023 -0300
Small style improvements
- No longer using one screen to display emails
diff --git a/www/mail.html b/www/mail.html
deleted file mode 100644
index a1bd9e5..0000000
--- a/www/mail.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{{template "head.html"}}
-{{with $subj := printf "%s/%s" (.Get "inbox") (.Get "subj")}}
-{{with $inbox := ($.Get "inbox")}}
-<b>{{$.Get "subj"}}</b><br>
-<br>
-<a href="mails.html?inbox={{$inbox}}&subj={{index $.subj 0}}">back</a>
-
-{{range (mails $subj)}}
-<p>
- {{if eq .From $inbox}}To: {{index .To 0}}<br>{{else}}From: {{.From}}<br>{{end}}
- Date: {{.Date.Format "Mon, 02 Jan 2006 15:04:05 MST"}}<br>
- {{if .Cc}}Cc: .Cc<br>{{end}}
- {{if .Attachments}}
- <br>
- Attachments:<br>
- {{range .Attachments}}
- <a href="data:{{.ContentType}};base64,{{.Data}}" download="{{.Name}}">{{.Name}}</a><br>
- {{end}}
- {{end}}
-</p>
- {{if .Body}}
- <pre>{{.Body}}</pre>
- {{end}}
- <br>
- <a href="compose.html?inbox={{$inbox}}&subj={{.Subject}}&to={{.From}}">reply</a>
-{{end}}
-{{end}}
-{{end}}
commit 2007e86d8554a354757cbc360eb6fb882bc1f646
Author: blmayer <bleemayer@gmail.com>
Date: Thu Apr 20 03:07:17 2023 -0300
Small style improvements
- No longer using one screen to display emails
diff --git a/www/mails.html b/www/mails.html
index ff2d01e..235b2c0 100644
--- a/www/mails.html
+++ b/www/mails.html
@@ -1,30 +1,23 @@
{{template "head.html"}}
-
-<b>about {{.Get "inbox"}}</b><br>
+<b>about {{.Get "subj"}}</b><br>
<br>
<a href="inboxes.html?inbox={{.Get "inbox"}}">inbox</a> 
-<a href="compose.html?inbox={{.Get "inbox"}}">compose</a><br>
-<br>
+<a href="compose.html?inbox={{.Get "inbox"}}&subj={{.Get "subj"}}">compose</a><br>
{{range (mails (print (.Get "inbox") "/" (.Get "subj")))}}
- <a href="mail.html?inbox={{$.Get "inbox"}}&subj={{$.Get "subj"}}&id={{.ID}}">{{$.Get "subj"}}</a><br>
- {{if eq ($.Get "inbox") .From}}
- To: {{index .To 0}}</a><br>
- {{else}}
- From: {{.From}}<br>
- {{end}}
+<p>
+ {{if eq ($.Get "inbox") .From}}To: {{index .To 0}}{{else}}From: {{.From}}{{end}}<br>
Date: {{.Date.Format "Mon, 02 Jan 2006 15:04:05 MST"}}<br>
- {{if .Cc}}
- Cc: .Cc<br>
- {{end}}
+ {{if .Cc}}Cc: .Cc<br>{{end}}
{{if .Attachments}}
Attachments:<br>
{{range .Attachments}}
- {{.Name}}<br>
+ <a href="data:{{.ContentType}};base64,{{.Data}}" download="{{.Name}}">{{.Name}}</a><br>
{{end}}
{{end}}
{{if .Body}}
- Body: {{heading .Body 50}}<br>
+ <pre>{{.Body}}</pre>
{{end}}
- <br>
+ <a href="compose.html?inbox={{$.Get "inbox"}}&subj={{.Subject}}&to={{.From}}">reply</a>
+</p>
{{end}}
commit 2007e86d8554a354757cbc360eb6fb882bc1f646
Author: blmayer <bleemayer@gmail.com>
Date: Thu Apr 20 03:07:17 2023 -0300
Small style improvements
- No longer using one screen to display emails
diff --git a/www/style-min.html b/www/style-min.html
index 99f3c18..1c4fa65 100644
--- a/www/style-min.html
+++ b/www/style-min.html
@@ -1,8 +1,8 @@
<style>
body {
- max-width: 800px;
- padding: 0 20px;
- margin: 50px auto;
+ max-width: 600px;
+ padding: 0 15px;
+ margin: 40px auto;
font-family: sans-serif;
}
table {