list

server

This is the main dovel repository, it has the Go code to run dovel SMTP server.

curl https://dovel.email/server.tar tar

5261a3a

Author: bmayer3 (bmayer@sibros.tech)

Date: Sun Mar 12 17:46:42 2023 -0300

Parent: 66ed831

Improved pages

- Removed dead code
- Updated landing page

Diff

cmd/dovel/main.go

commit 5261a3aff147ce64cdbca2c42e5aeb8de84d1fa0
Author: bmayer3 <bmayer@sibros.tech>
Date:   Sun Mar 12 17:46:42 2023 -0300

    Improved pages
    
    - Removed dead code
    - Updated landing page

diff --git a/cmd/dovel/main.go b/cmd/dovel/main.go
index f97cb89..5afbd59 100644
--- a/cmd/dovel/main.go
+++ b/cmd/dovel/main.go
@@ -5,92 +5,27 @@ import (
 	"crypto/x509"
 	"encoding/json"
 	"encoding/pem"
-	"fmt"
-	"io"
 	"io/ioutil"
 	"log"
 	"net/http"
 	"os"
-	"strings"
 	"time"
 
 	"blmayer.dev/x/dovel/config"
-	"blmayer.dev/x/dovel/interfaces"
 	"blmayer.dev/x/dovel/interfaces/backend"
 	"blmayer.dev/x/dovel/interfaces/file"
 	"blmayer.dev/x/dovel/interfaces/gwi"
 
-	"github.com/OfimaticSRL/parsemail"
 	"github.com/emersion/go-smtp"
 )
 
-// A Session is returned after EHLO.
-type Session struct {
-	User     string
-	handlers map[string]config.Handler
-}
-
-func (s Session) AuthPlain(username, password string) error {
-	println("connection sent", username, password)
-	return nil
-}
-
-func (s Session) Mail(from string, opts *smtp.MailOptions) error {
-	println("Mail from:", from)
-	return nil
-}
-
-func (s Session) Rcpt(to string) error {
-	println("Rcpt to:", to)
-	return nil
-}
-
-func (s Session) Data(r io.Reader) error {
-	content, err := io.ReadAll(r)
-	if err != nil {
-		println("read content", err.Error())
-		return err
-	}
-
-	email, err := parsemail.Parse(strings.NewReader(string(content)))
-	if err != nil {
-		println("parse email", err.Error())
-		return err
-	}
-
-	// get user from to field
-	mail := interfaces.ToEmail(email)
-	for _, to := range mail.To {
-		userDomain := strings.Split(to, "@")
-		handler, ok := s.handlers[userDomain[1]]
-		if !ok {
-			println("no handler for domain", userDomain[1])
-			return fmt.Errorf("no handler for domain %s", userDomain)
-		}
-		mail.To = []string{to}
-		if err := handler(mail); err != nil {
-			println("handler error", err.Error())
-			return fmt.Errorf("handler error %s", err.Error())
-		}
-	}
-
-	return nil
-}
-
-func (s Session) Reset() {}
-
-func (s Session) Logout() error {
-	println("logged out")
-	return nil
-}
-
 var (
 	defaultPort   = "8080"
 	defaultConfig = config.Config{
 		WebPort: &defaultPort,
 		Server: config.ServerConfig{
-			Domain:  "dovel.email",
-			Address: ":2525",
+			Domain:      "dovel.email",
+			Address:     ":2525",
 			DKIMKeyPath: "dkim.priv",
 			Inboxes: []config.InboxConfig{
 				{

index.html

commit 5261a3aff147ce64cdbca2c42e5aeb8de84d1fa0
Author: bmayer3 <bmayer@sibros.tech>
Date:   Sun Mar 12 17:46:42 2023 -0300

    Improved pages
    
    - Removed dead code
    - Updated landing page

diff --git a/index.html b/index.html
index d3cf7dc..eb0073e 100644
--- a/index.html
+++ b/index.html
@@ -36,7 +36,7 @@ tt {
 <body>
 	<center>
 		<h1>Dovel</h1>
-		<i>Self host your email in 3 easy steps.</i>
+		<i>Self host your email in 4 easy steps.</i>
 		<p>
 		<a href=https://goreportcard.com/report/blmayer.dev/x/dovel><img src=https://goreportcard.com/badge/blmayer.dev/x/dovel></a>
 		&emsp;
@@ -86,19 +86,25 @@ tt {
 	systems.
 	<ol>
 		<li>
-			Clone the repo in your build machine, or directly on
-			your server with the command:
-			<tt>git clone https://blmayer.dev/x/dovel</tt>.
+			Install dovel by running:
+			<tt>go install blmayer.dev/x/dovel/cmd/dovel</tt>.
 		</li>
 		<li>
-			Build the server <tt>make dovel</tt>, to start the
-			server, you need to set the configuration file, an
+			Configure dovel by creating the configuration file, an
 			example is provided below. Running <tt>dovel</tt>
 			is enough to start.
 		</li>
 		<li>
 			Configure your MX record in your domain registrar to
-			point to your server.
+			point to your server. This is needed to receive email.
+			Define a password for your user using the environment
+			variable DOVEL_PASS.
+		</li>
+		<li>
+			Configure other DNS records as you wish in your domain
+			registrar such as PTR, SPF, DKIM or DMARC to improve
+			sending emails. Dovel supports DKIM by passing the key
+			path in the configuration file.
 		</li>
 	</ol>
 
@@ -112,6 +118,7 @@ tt {
 	"server": {
 		"address": ":25",
 		"domain": "dovel.email",
+		"dKIMKeyPath": "dkim.priv",
 		"inboxes": [
 			{
 				"domain": "user.dovel.email",
@@ -136,17 +143,17 @@ tt {
 	Using <tt>dovel</tt> email server and the web interface is meant to be
 	super easy: the server uses the configuration above, you can add more
 	inboxes. The web interface is much more interesting: It uses the
-	Golang <tt>template</tt> package to build pages.
+	Golang <tt>template</tt> package to build pages. The default user is
+	"x", the password is set using an environment variable.
 
 	<p>
 	As a starting point, look at the <tt>www/</tt> folder in our git repo.
 	They are templates that you can customize to your needs. Once you're
-	done simply restart the <tt>dovel</tt> application to apply
-	changes.
+	done simply restart the <tt>dovel</tt> application to apply changes.
 	</p>
 
 	<p>
-	I currently use dovel for my personal email, and my git mail workflow.
+	I currently use dovel for my personal email and my git mail workflow.
 	</p>
 
 	<h3>Functions</h3>

www/mail.html

commit 5261a3aff147ce64cdbca2c42e5aeb8de84d1fa0
Author: bmayer3 <bmayer@sibros.tech>
Date:   Sun Mar 12 17:46:42 2023 -0300

    Improved pages
    
    - Removed dead code
    - Updated landing page

diff --git a/www/mail.html b/www/mail.html
index 5cb4617..6cb2025 100644
--- a/www/mail.html
+++ b/www/mail.html
@@ -28,7 +28,9 @@
 	{{end}}
 	{{if .Body}}
 	<br>
-	{{.Body}}<br>
+	<pre>
+	{{.Body}}
+	</pre>
 	{{end}}
 	<br>
 {{end}}

www/mails.html

commit 5261a3aff147ce64cdbca2c42e5aeb8de84d1fa0
Author: bmayer3 <bmayer@sibros.tech>
Date:   Sun Mar 12 17:46:42 2023 -0300

    Improved pages
    
    - Removed dead code
    - Updated landing page

diff --git a/www/mails.html b/www/mails.html
index f75d124..ff2d01e 100644
--- a/www/mails.html
+++ b/www/mails.html
@@ -24,7 +24,7 @@
 	{{end}}
 	{{end}}
 	{{if .Body}}
-	Body: {{heading .Body 40}}<br>
+	Body: {{heading .Body 50}}<br>
 	{{end}}
 	<br>
 {{end}}

www/style-min.html

commit 5261a3aff147ce64cdbca2c42e5aeb8de84d1fa0
Author: bmayer3 <bmayer@sibros.tech>
Date:   Sun Mar 12 17:46:42 2023 -0300

    Improved pages
    
    - Removed dead code
    - Updated landing page

diff --git a/www/style-min.html b/www/style-min.html
index 4eb6abd..6d9df80 100644
--- a/www/style-min.html
+++ b/www/style-min.html
@@ -1,8 +1,9 @@
 <style>
 	body {
-		width: 541;
-		margin: 99 auto;
-		font-family: monospace;
+		max-width: 800;
+		padding: 0 20px;
+		margin: 50 auto;
+		font-family: sans-serif;
 	}
 	a {
 		color: #888
@@ -23,6 +24,8 @@
 		display: inline-block;
 		min-width: 80;
 	}
-
+	pre {
+		white-space: pre-wrap;
+	}
 </style>