Documentation
¶
Overview ¶
email is a SMTP server that is simple to setup and use.
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 structure of this config file is git.derelict.garden/dovel/email/config.Config. See that doc for more info.
Setting up your email server ¶
Email works in a complex way, DNS records must match your server's configuration. This guide will try to give more detailed information in comparison with the website tutorial.
An email server typically listens on ports 25, 2525, 587 or 465 for mail exchange. But their use differ:
- 25: is the original SMTP port and first to be official by RFC.
- 465: is marked as deprecated.
- 587: is also official by RFC, this port is used for TLS encrypted mail.
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
Be sure to make the file executable.
Configuring DNS records ¶
To receive emails you need to setup the MX record in your domain registrar, sending email is more complicated, some receiving servers only need the SPF and PTR records, some also need DKIM and DMARK, adjust according to your needs.
Sending email ¶
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 contains interfaces that are passed to the common functions on the server and web projects. You can import this to use on templates and handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.9.0
Config is used to configure your email server. Port is used to specify which port the server should listen to connections, a typicall value is 2525. Domain is what the server should respond in a HELO or EHLO request. VaultFile is the path to a json file containing the list of users that can send email.