.gitignore | ||
config.example.json | ||
config.go | ||
go.mod | ||
go.sum | ||
imap_get_messages.go | ||
main.go | ||
model.go | ||
openrc-file | ||
pull.sh | ||
ReadMe.md | ||
run.sh |
smtpd-delivery-monitor
A simple HTTP API which also tails the smtpd log.
Your application calls the smtpd-delivery-monitor
POST /send
API, passing an auth token and email address, subject, and body to send.
Then smtpd-delivery-monitor
turns around and submits the email over SMTP to your smtpd
server. However, the HTTP request continues to block until it sees a corresponding entry in the smtpd
log (or times out after 30 seconds.)
Then the API responds with a JSON object that lets you know if smtpd
said the email was delivered or not.
It will also refuse to send emails if a lot of emails have been bounced for that address recently.
usage example
domechild:/opt/smtpd-delivery-monitor# curl -H "Authorization: ..something long and un-guessable.." -X POST http://localhost:9184/send -d '{
> "To": "forest.n.johnson@gmail.com",
> "Subject": "test",
> "Body": "teeeeeeeest"
> }'
{"Attempted":true,"Delivered":true,"Error":"The email server at gmail.com said: Ok: with a message of '250 2.0.0 OK 1733397156 00721157ae682-6efd3a28021si8558147b3.409 - gsmtp'.","WaitUntilTimestampMs":0}
deploy to domechild
I can't figure out how to get the damn openrc service to work. It always either hangs on stop or stops without shutting down the process.
So for now it runs on a tmux :X
go build -tags netgo,osusergo -o smtpd-delivery-monitor
curl https://webclip.sequentialread.com/smtpd-delivery-monitor | bash
ssh domechild.cyberia.club
tmux a
Ctrl - C
./pull.sh
Ctrl - B
d
You can check the log with
tail -n 100 -f /var/log/smtpd-delivery-monitor.log