mirror of
https://github.com/Dvorinka/SendMail.git
synced 2026-07-29 10:03:48 +00:00
Merge branch 'main' of https://github.com/Dvorinka/SendMailfe
This commit is contained in:
@@ -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))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user