Categorygithub.com/jo-hoe/go-mail-service
modulepackage
2.0.0+incompatible
Repository: https://github.com/jo-hoe/go-mail-service.git
Documentation: pkg.go.dev

# README

Mail Service

Test Status Lint Status Go Report Card Coverage Status

A simple mail service that allow to send mails. Currently only Sendgrid is implemented.

Setup

Prerequisites

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 you want to deploy and access the service on k3d you will need to install the following tools:

Run the project using make. Make is typically installed by default 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

The service offers a basic API to send mails. One can specify the subject, content, and addressed to send to.

curl -H "Content-Type: application/json" --data '{"subject":"my subject", "content":"my message", "to":"[email protected],[email protected]"}' 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 ./...

# Packages

No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author