sendgrid-dev

command module
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: MIT-0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

SendGrid Mock API

SendGrid Dev is SengGrid mock API for test your sendgrid emails during development.

SengGrid MailDev is Docker container with SendGrid Mock API + MailDev.

Requirements

  • Go 1.26+

Debug

Sample with MailDev (Can work by default)

Run maildev

docker pull maildev/maildev
docker run -p 1080:1080 -p 1025:1025 maildev/maildev

Run SendGrid Mock API

go run main.go

Send mail by curl

curl --request POST \
  --url http://localhost:3030/v3/mail/send \
  --header 'Authorization: Bearer SG.xxxxx' \
  --header 'Content-Type: application/json' \
  --data '{"personalizations": [{ 
    "to": [{"email": "to@example.com"}]}], 
    "from": {"email": "from@example.com"}, 
    "subject": "Test Subject", 
    "content": [{"type": "text/plain", "value": "Test Content"}] 
  }'

Check with maildev

http://localhost:1080/

Sample with MailTrap (with SMTP Auth)

Run SendGrid Mock API

export SENDGRID_DEV_API_SERVER=:3030
export SENDGRID_DEV_API_KEY=SG.xxxxx
export SENDGRID_DEV_SMTP_SERVER=smtp.mailtrap.io:25
export SENDGRID_DEV_SMTP_USERNAME=mailtrap_username
export SENDGRID_DEV_SMTP_PASSWORD=mailtrap_password
go run main.go

Send mail by curl

curl --request POST \
  --url http://localhost:3030/v3/mail/send \
  --header 'Authorization: Bearer SG.xxxxx' \
  --header 'Content-Type: application/json' \
  --data '{"personalizations": [{ 
    "to": [{"email": "to@example.com"}]}], 
    "from": {"email": "from@example.com"}, 
    "subject": "Test Subject", 
    "content": [{"type": "text/plain", "value": "Test Content"}] 
  }'

Check with mailtrap Inbox

https://mailtrap.io/inboxes

Test

go test

Build

x86_64
env GOOS=linux GOARCH=amd64 go build -o sendgrid-dev_x86_64 main.go
arm64
env GOOS=linux GOARCH=arm64 go build -o sendgrid-dev_aarch64 main.go

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
model

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL