Add basic support for multiple recipients
This commit is contained in:
parent
a103309935
commit
e90d4579ae
2 changed files with 10 additions and 3 deletions
|
@ -271,9 +271,8 @@ func handleCompose(ectx echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Request().Method == http.MethodPost {
|
if ctx.Request().Method == http.MethodPost {
|
||||||
// TODO: parse address lists
|
|
||||||
from := ctx.FormValue("from")
|
from := ctx.FormValue("from")
|
||||||
to := ctx.FormValue("to")
|
to := parseAddressList(ctx.FormValue("to"))
|
||||||
subject := ctx.FormValue("subject")
|
subject := ctx.FormValue("subject")
|
||||||
text := ctx.FormValue("text")
|
text := ctx.FormValue("text")
|
||||||
|
|
||||||
|
@ -289,7 +288,7 @@ func handleCompose(ectx echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.From = from
|
msg.From = from
|
||||||
msg.To = []string{to}
|
msg.To = to
|
||||||
msg.Subject = subject
|
msg.Subject = subject
|
||||||
msg.Text = text
|
msg.Text = text
|
||||||
|
|
||||||
|
|
|
@ -47,3 +47,11 @@ func parsePartPath(s string) ([]int, error) {
|
||||||
}
|
}
|
||||||
return path, nil
|
return path, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parseAddressList(s string) []string {
|
||||||
|
l := strings.Split(s, ",")
|
||||||
|
for i, addr := range l {
|
||||||
|
l[i] = strings.TrimSpace(addr)
|
||||||
|
}
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue