This commit is contained in:
Tomáš Dvořák
2025-09-10 14:09:02 +02:00
+4 -6
View File
@@ -6,8 +6,8 @@ import (
"html" "html"
"log" "log"
"net/http" "net/http"
"strings"
"strconv" "strconv"
"strings"
"gopkg.in/gomail.v2" "gopkg.in/gomail.v2"
) )
@@ -290,6 +290,7 @@ func enableCors(handler http.HandlerFunc) http.HandlerFunc {
// sendParamsHandler handles sending email with explicit SMTP parameters via query string. // sendParamsHandler handles sending email with explicit SMTP parameters via query string.
// Example: // Example:
//
// GET /[email protected]&pass=secret&server=smtp.example.com&port=465&[email protected]&[email protected]&subject=Hello&message=Hi // GET /[email protected]&pass=secret&server=smtp.example.com&port=465&[email protected]&[email protected]&subject=Hello&message=Hi
func sendParamsHandler(w http.ResponseWriter, r *http.Request) { func sendParamsHandler(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet { if r.Method != http.MethodGet {
@@ -351,9 +352,6 @@ func sendParamsHandler(w http.ResponseWriter, r *http.Request) {
func main() { func main() {
http.HandleFunc("/send", enableCors(sendHandler)) http.HandleFunc("/send", enableCors(sendHandler))
http.HandleFunc("/send-params", enableCors(sendParamsHandler)) log.Println("Server running on :660")
http.HandleFunc("/", enableCors(rootHandler)) log.Fatal(http.ListenAndServe(":660", nil))
log.Println("Server running on :8080")
log.Fatal(http.ListenAndServe(":8080", nil))
} }