Skip to content

Commit

Permalink
Add: more examples to README
Browse files Browse the repository at this point in the history
  • Loading branch information
danyanya committed Nov 10, 2019
1 parent ed00817 commit ea94c6b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM interlegis/alpine-postfix
FROM interlegis/alpine-postfix:3.3.0

LABEL maintainer="Danya Sliusar <[email protected]>"

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
APP_NAME=sendmail-http


all: build

build:
Expand Down
47 changes: 41 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,55 @@
# sendmail http

Simple http server for sendmail (based on postfix alpine)


Simple http server with Email sending. Now support Sendmail and Mutt as backend.



## Build

Binary can be built by execute:

```
make build
Binary can be built by *make*:

```bash
make build
# this creates binary in *bin* directory
ls bin/
# sendmail-http
```

To make docker image exec:
To make Docker image:

```bash
make docker
# or building by your own image
docker build -t your-own/sendmail-http .
```

make docker
## Running

```bash
# Running directly with Docker
docker run -d -t --name sendmail \
-p 1001:1001 \
danyanya/sendmail-http:latest
# or by docker-compose
docker-compose up -d
```

## Usage

For send email use **/api/sendmutt** endpoint:

```bash
# Get params are from, to, subject and body:
curl -sSl localhost:1001/sendmutt?[email protected]&[email protected]&subject=[job%20offer]&body=Confirmation,$%20Steve!

# Also it accepts file, but it needed to be in container!
#!! &file=/tmp/some.xls
```

## Copyright

Repo created by Daniil Sliusar at 2019.
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func main() {

var apiGroup = e.Group("/api")

// GET HTTP endpoint to send Emails with sendmail
// GET HTTP endpoint to send emails via sendmail
apiGroup.GET("/sendmail", func(c echo.Context) error {

var req = mailReq{}
Expand All @@ -101,8 +101,8 @@ func main() {
)
})

// GET HTTP endpoint to send emails via mutt
apiGroup.GET("/sendmutt", func(c echo.Context) error {

var req = mailReq{}
if err := c.Bind(&req); err != nil {
return c.JSON(http.StatusBadRequest,
Expand All @@ -120,8 +120,7 @@ func main() {
)
})

var err = e.Start(serverAddr)
if err != nil {
if err := e.Start(serverAddr); err != nil {
panic(err.Error())
}

Expand Down

0 comments on commit ea94c6b

Please sign in to comment.