Simple SendGrid Mock Server is SendGrid Mock Server on Docker. Mail is not actually sent. Instead, you can see the mails sent to you like a mailer. And SendGrid v3 API Support.
Starting on the command-line:
docker run -p 3030:3030 -env SENDGRID_API_KEY=YOUR_API_KEY -env SESSION_COOKIE_SECRET=YOUR_SECRET -t yudppp/simple-sendgrid-mock-server
The port 3030
is for HTTP.
SendGrid Web API v3 mock,
import "github.com/sendgrid/sendgrid-go"
func SendMail() error {
request := sendgrid.GetRequest(mockAPIKey, "/v3/mail/send", mockedHost)
...
}
Please input your YOUR_API_KEY
.
Responced Stored All Message.
> curl http://localhost:3030/json?token=YOUR_API_KEY
[
{
"personalizations": [
{
"to": [
{
"email": "[email protected]"
}
]
}
],
"from": {
"email": "[email protected]"
},
"subject": "Hello, World!",
"sent_at": 1630322977319,
"content": [
{
"type": "text/plain",
"value": "Heya!"
}
]
},
{
"personalizations": [
{
"to": [
{
"email": "[email protected]"
}
]
}
],
"from": {
"email": "[email protected]"
},
"subject": "Hello, World!",
"sent_at": 1630322914938,
"content": [
{
"type": "text/plain",
"value": "Heya!"
}
]
}
]