Skip to content

paolodenti/smtp2webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMTP To webhook

Integration Tests Integration Tests

Simple SMTP to to webhook, for internal use.

It sends the content of an incoming email to a webhook.

SMTP protocol is implemented without TLS/SSL/Authentication. Only for internal use. Do not publicly expose it.

How to use it

# send with POST, as json
WEBHOOK_URL=<your webhook> \
  ./mvnw spring-boot:run
# send with GET and query params
WEBHOOK_URL=<your webhook> \
WEBHOOK_METHOD=GET \
  ./mvnw spring-boot:run
# force a content type
WEBHOOK_URL=<your webhook> \
WEBHOOK_METHOD=POST \
WEBHOOK_CONTENT_TYPE=text/plain \
  ./mvnw spring-boot:run

Listening port

By default, the smtp listens on port 2525.

To change the listening port set the SMTP_PORT environment variable, e.g.

WEBHOOK_URL=<your webhook> \
SMTP_PORT=25 \
  ./mvnw spring-boot:run

Message format

POST

When WEBHOOK_METHOD is POST (default value), the webhook receives a json payload, in post, like the one below.

The content type is set to the value of WEBHOOK_CONTENT_TYPE (default application/json).

{
  "recipient": "[email protected]",
  "from": "[email protected]",
  "content": "this is the email body\r\non two lines",
  "subject": "this is the subject"
}

GET

When WEBHOOK_METHOD is GET, the webhook is invoked with the following URL

<your webhook>[email protected]&[email protected]&content=the-content&subject=the-subject"

Docker image

docker run --rm -d \
  -e WEBHOOK_URL=<your webhook> \
  -p 25:2525 \
  paolodenti/smtp2webhook:latest

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published