Meilo is an implementation of a test/development SMTP server written in Go. Meilo opens sent emails instead of sending them, this allows development workflows where ONLY the SMTP credentials are changed.
-
Meilo requies Go 1.23 or later, you can download it from here
-
Meilo package:
go get github.com/wawandco/meilo
You have the ability to set the options for the SMTP server, these are totally optional, if you don't set them, Meilo will use the default values.
// Start the SMTP server
creds, err := meilo.Start(
// Directory to put the files
meilo.WithDir("/my/emails/folder"),
// Port to use
meilo.WithPort("1025"),
)
if err != nil {
// Handle the error starting the server.
...
}
This will start the SMTP server and return the credentials to be used in the email sending process.
//Then you can use the credentials to build the SMTP auth
auth := smtp.PlainAuth("", creds.User, creds.Password, creds.Host),
from := "[email protected]"
to:= []string{"[email protected]"}
body:= []byte("Hello from meilo!")
// And then the creds instance has an Addr method to use when sending
err = smtp.SendMail(creds.Addr(), auth, from ,to, body)
if err != nil {
// Handle the sending error
...
}
Allows to specify the directory where the emails will be stored, by default it will use the system's temporary directory.
Allows to specify the port of the SMTP server. This is useful when running multiple services in your development environment.
- Web interface
- UI Improvements.
- Deployable service for Staging/Testing.
- Listing historically sent emails.