Gomtp is a cli tool to test smtp settings easily.
You can install the gomtp
to Linux or macOS with these commands:
sudo curl -L -o /usr/local/bin/gomtp "https://github.com/safderun/gomtp/releases/latest/download/gomtp-$(uname -s)-$(uname -m)" && \
sudo chmod +x /usr/local/bin/gomtp
You can build the gomtp
locally, on your own machine.
version=$(git describe --tags --abbrev=0) && \
commitId=$(git rev-parse --short $version) && \
go build -ldflags "-X gomtp/cmd.version=$version -X gomtp/cmd.commitId=$commitId" -o gomtp -v .
- Create a
gomtp.yaml
file anywhre you want. - Take the template from the
gomtp.yaml
- There is 4 templates for
mailhog
,gmail
,yandex
andbrevo
subject
andbody
is optional.- In the same directory with your configured
gomtp.yaml
, rungomtp
with no argument.
❯ gomtp
Email sent successfully!
- If your configuration is valid, you will see the "Email sent successfully!" message.
-
You can name the
gomtp.yaml
as you wish while creating the configuration. -
If you change the default configuration file name, you can pass the path of the file to the
gomtp
.
gomtp --file test.yaml
or
gomtp -f test.yaml
- To test the
gomtp
quickly, you can run themailhog
fromdocker-compose.yml
docker compose up -d
- Configure
gomtp.yaml
- The default
gomtp.yaml
file has been configured for the mailhog.
- The default
- Open the
mailhog
web ui from http://127.0.0.1:8025 - Run the
gomtp
.
gomtp
- Define a version.
export gomtpVersion=v1.4.0
- You should create a release branch from the master
git checkout master && git pull && \
git checkout -b release/${gomtpVersion}
- Tag the commit
git tag --sign ${gomtpVersion} -m "Added verifyCertificate and example commands."
- Push the release branch and tags
git push && git push --tags
- Before run the tests, run the docker compose file.
docker compose up -d
- You can run e2e tests to ensure application stability.
go test -c -o gomtp.test ./cmd/ && \
./gomtp.test
- Check the test coverage:
go test -coverprofile=coverage.out -c -o gomtp.test ./cmd/ && \
./gomtp.test -test.coverprofile ./c.out
- You can see covered lines with html report:
go test -coverprofile=coverage.out -c -o gomtp.test ./cmd/ && \
./gomtp.test -test.coverprofile ./c.out && \
go tool cover -html=c.out