diff --git a/main.go b/main.go index 04946c6..2695134 100644 --- a/main.go +++ b/main.go @@ -2,13 +2,108 @@ package main import ( "encoding/json" + "fmt" + "html" "log" "net/http" "strings" + "strconv" "gopkg.in/gomail.v2" ) +// Copyable snippets used by /docs and dedicated snippet endpoints +const docsHTMLSnippet = ` +
Server: http://localhost:8080
Tělo JSON: { domain?, name, email, subject, message }
Volitelné SMTP v query: ?email=&pass=&server=&port=
curl -X POST http://localhost:8080/send \
+ -H "Content-Type: application/json" \
+ -d '{
+ "domain":"sportcreative.eu",
+ "name":"Jan Novák",
+ "email":"jan@example.com",
+ "subject":"Dotaz",
+ "message":"Dobrý den..."
+ }'
+
+ curl -X POST "http://localhost:8080/send?email=USER@example.com&pass=SECRET&server=smtp.example.com&port=465" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name":"Jan Novák",
+ "email":"jan@example.com",
+ "subject":"Dotaz",
+ "message":"Dobrý den..."
+ }'
+
+ Query: ?email=&pass=&server=&port=&to=&from=&subject=&message= (když chybí to/from, použije se email).
curl "http://localhost:8080/send-params?email=USER@example.com&pass=SECRET&server=smtp.example.com&port=465&to=dest@example.com&from=USER@example.com&subject=Hello&message=Ahoj"
+ %s
+ %s
+