Mail Service
Service that allow to send mails. Currently only Sendgrid is implemented.
Setup
Pre-Requisites
Optional
If you do not have it and run on Windows, you can directly install it from gnuwin32 or via winget
winget install GnuWin32.Make
In case your want to deploy and access the service on k3d you will need to install the following tools:
Use make
to run the project. Make is typically installed out of the box on Linux and Mac.
Environment
Setup an .env file with the following content
API_PORT=80
IS_SENDGRID_ENABLED=true
IS_NOOP_ENABLED=false
DEFAULT_FROM_ADDRESS=<email address>
DEFAULT_FROM_NAME=<mail sender in clear text>
SENDGRID_API_KEY=<sendgrid api key>
Run
Docker
For plain docker run to the following commands
docker build . -t go-mail-service
docker run --rm -p 80:80 --env-file .env go-mail-service
K3s
To run in k3d use the following command
make start-k3s
Example Request
curl -H "Content-Type: application/json" --data '{"subject":"my subject", "content":"my message", "to":["test@mail.de"]}' http://localhost:80/v1/sendmail
Linting
The project used golangci-lint
for linting.
Installation
https://golangci-lint.run/welcome/install/
Run Linting
Run the linting locally by executing.
golangci-lint run ./...