This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: blmayer (bleemayer@gmail.com)
Date: Thu Sep 14 15:40:40 2023 -0300
Parent: f887f0c
Minor adjustments
commit 7b5d4ee02547fcb65c2de9c177863143d7e7eef6 Author: blmayer <bleemayer@gmail.com> Date: Thu Sep 14 15:40:40 2023 -0300 Minor adjustments diff --git a/cmd/dovel/backend.go b/cmd/dovel/backend.go index 6ada099..061c6da 100644 --- a/cmd/dovel/backend.go +++ b/cmd/dovel/backend.go @@ -136,6 +136,7 @@ func (s *Session) Logout() error { return nil } +// TODO: remove pgp logic, move to client packages func (s *Session) Send(from string, tos []string, raw io.Reader) error { email, err := mail.ReadMessage(raw) if err != nil {
commit 7b5d4ee02547fcb65c2de9c177863143d7e7eef6 Author: blmayer <bleemayer@gmail.com> Date: Thu Sep 14 15:40:40 2023 -0300 Minor adjustments diff --git a/cmd/dovel/main.go b/cmd/dovel/main.go index 28e5b20..47efe03 100644 --- a/cmd/dovel/main.go +++ b/cmd/dovel/main.go @@ -34,9 +34,11 @@ func main() { json.NewDecoder(configFile).Decode(&cfg) domain = cfg.Domain - v, err = vault.NewJSONPlainTextVault[email.User](cfg.VaultFile) - if err != nil { - panic(err) + if cfg.VaultFile != "" { + v, err = vault.NewJSONPlainTextVault[email.User](cfg.VaultFile) + if err != nil { + panic(err) + } } s := smtp.NewServer(backend{})
commit 7b5d4ee02547fcb65c2de9c177863143d7e7eef6 Author: blmayer <bleemayer@gmail.com> Date: Thu Sep 14 15:40:40 2023 -0300 Minor adjustments diff --git a/doc.go b/doc.go index edb7e06..e5f3ecf 100644 --- a/doc.go +++ b/doc.go @@ -1,25 +1,13 @@ // email is a SMTP server that is simple to setup and use. // -// This package has two parts: -// 1. The dovel binary -// 2. The library +// The binary is the main server, it is configured using a single config +// file which should be located in ~/.config/dovel/config.json. This server is +// responsible to receive your emails and save them according to your hooks. // -// # The binary -// -// This binary is the main server, it is configured using a single config -// file which should be located in ~/.dovel-config.json. This server is -// responsible to receive your emails and save them according to your config. -// The other part is the optional web interface that is used to visualize your -// mail. -// -// The structure of this config file is [git.derelict.garden/dovel/email/config.Config]. See that doc for more +// The structure of this config file is +// [git.derelict.garden/dovel/email/config.Config]. See that doc for more // info. // -// # The library -// -// This package also delivers a subpackage called email, it contains -// structs that are used through this project. -// // # Setting up your email server // // Email works in a complex way, DNS records must match your server's @@ -33,15 +21,27 @@ // - 465: is marked as deprecated. // - 587: is also official by RFC, this port is used for TLS encrypted mail. // -// The current recomendation in to use port 586. To configure this server see -// [git.derelict.garden/dovel/email/config.Config]. +// The current recomendation is to use port 586. Dovel works with any port, +// and the value must be set in the port field of the config file. To +// configure this server see [git.derelict.garden/dovel/email/config.Config]. +// +// To receive email only the MX record is enough. Everytime dovel receives an +// email it searches for an executable file in $XDG_CONFIG_DIR/dovel/hooks/ +// named receive-DOMAIN, for the DOMAIN receiving the email and executes it +// passing the email in mbox format as standard input. Then it is up to the +// script to decide what to do. See the scripts repo for examples. +// +// # Hooks +// +// A simple hook is a shell script that simply concatenates the received email +// to a .mbox file, e.g. to receive email for your domain create a file named +// receive-<DOMAIN> in the hooks folder with the following content: +// +// #!/bin/sh +// cat > ~/mail/dovel.mbox +// // -// The server itself only receives email, for this feature only the MX record -// is enough. Everytime dovel receives an email it searches for an executable -// file in $XDG_CONFIG_DIR/dovel/hooks/ named receive-DOMAIN, for the DOMAIN -// receiving the email and executes it passing the email in mbox format as -// standard input. Then it is up to the script to decide what to do. See the -// scripts repo for examples. +// Be sure to make the file executable. // // # Configuring DNS records // @@ -54,4 +54,8 @@ // // Dovel also sends email, for that it needs a valid VaultFile path on the // config. That means you need at least one user descrived on the json file. +// The format of that file is a JSON array of the [User] struct. +// +// Dovel is listening to commands on the port specified in the config file +// use any email client to communicate with dovel. package email