aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go.mod2
-rw-r--r--go.sum8
-rw-r--r--plugins/base/routes.go15
-rw-r--r--plugins/base/smtp.go22
-rw-r--r--themes/alps/compose.html4
5 files changed, 38 insertions, 13 deletions
diff --git a/go.mod b/go.mod
index e628789..0d85e57 100644
--- a/go.mod
+++ b/go.mod
@@ -12,7 +12,7 @@ require (
github.com/emersion/go-imap-metadata v0.0.0-20200128185110-9d939d2a0915
github.com/emersion/go-imap-move v0.0.0-20190710073258-6e5a51a5b342
github.com/emersion/go-imap-specialuse v0.0.0-20161227184202-ba031ced6a62
- github.com/emersion/go-message v0.11.2
+ github.com/emersion/go-message v0.13.1-0.20201112194930-f77964fe28bd
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21
github.com/emersion/go-smtp v0.13.0
github.com/emersion/go-vcard v0.0.0-20200508080525-dd3110a24ec2
diff --git a/go.sum b/go.sum
index bb29840..36bf90d 100644
--- a/go.sum
+++ b/go.sum
@@ -42,6 +42,8 @@ github.com/emersion/go-message v0.11.1 h1:0C/S4JIXDTSfXB1vpqdimAYyK4+79fgEAMQ0dS
github.com/emersion/go-message v0.11.1/go.mod h1:C4jnca5HOTo4bGN9YdqNQM9sITuT3Y0K6bSUw9RklvY=
github.com/emersion/go-message v0.11.2 h1:oxO9SQ+3wgBAQRdk07eqfkCJ26Tl8ZHF7CcpGVoE00o=
github.com/emersion/go-message v0.11.2/go.mod h1:C4jnca5HOTo4bGN9YdqNQM9sITuT3Y0K6bSUw9RklvY=
+github.com/emersion/go-message v0.13.1-0.20201112194930-f77964fe28bd h1:6CXxdoOzAyQForkd2U/JNceVyNpmg92alCU2R+4dwIY=
+github.com/emersion/go-message v0.13.1-0.20201112194930-f77964fe28bd/go.mod h1:SXSs/8KamlsyxjpHL1Q3yf5Jrv7QG5icuvPK1SMcnzw=
github.com/emersion/go-sasl v0.0.0-20191210011802-430746ea8b9b h1:uhWtEWBHgop1rqEk2klKaxPAkVDCXexai6hSuRQ7Nvs=
github.com/emersion/go-sasl v0.0.0-20191210011802-430746ea8b9b/go.mod h1:G/dpzLu16WtQpBfQ/z3LYiYJn3ZhKSGWn83fyoyQe/k=
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 h1:OJyUGMJTzHTd1XQp98QTaHernxMYzRaOasRir9hUlFQ=
@@ -50,6 +52,8 @@ github.com/emersion/go-smtp v0.13.0 h1:aC3Kc21TdfvXnuJXCQXuhnDXUldhc12qME/S7Y3Y9
github.com/emersion/go-smtp v0.13.0/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
github.com/emersion/go-textwrapper v0.0.0-20160606182133-d0e65e56babe h1:40SWqY0zE3qCi6ZrtTf5OUdNm5lDnGnjRSq9GgmeTrg=
github.com/emersion/go-textwrapper v0.0.0-20160606182133-d0e65e56babe/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U=
+github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 h1:IbFBtwoTQyw0fIM5xv1HF+Y+3ZijDR839WMulgxCcUY=
+github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U=
github.com/emersion/go-vcard v0.0.0-20191221110513-5f81fa0d3cc7 h1:SE+tcd+0kn0cT4MqTo66gmkjqWHF1Z+Yha5/rhLs/H8=
github.com/emersion/go-vcard v0.0.0-20191221110513-5f81fa0d3cc7/go.mod h1:HMJKR5wlh/ziNp+sHEDV2ltblO4JD2+IdDOWtGcQBTM=
github.com/emersion/go-vcard v0.0.0-20200508080525-dd3110a24ec2 h1:g1RgqggIPPkEBubnOxAbIglxjMsP0aHPO2ryigBHu2s=
@@ -96,6 +100,8 @@ github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/martinlindhe/base36 v1.0.0 h1:eYsumTah144C0A8P1T/AVSUk5ZoLnhfYFM3OGQxB52A=
github.com/martinlindhe/base36 v1.0.0/go.mod h1:+AtEs8xrBpCeYgSLoY/aJ6Wf37jtBuR0s35750M27+8=
+github.com/martinlindhe/base36 v1.1.0 h1:cIwvvwYse/0+1CkUPYH5ZvVIYG3JrILmQEIbLuar02Y=
+github.com/martinlindhe/base36 v1.1.0/go.mod h1:+AtEs8xrBpCeYgSLoY/aJ6Wf37jtBuR0s35750M27+8=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
@@ -192,6 +198,8 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.4-0.20201021145329-22f1617af38e h1:0kyKOEC0chG7FKmnf/1uNwvDLc3NtNTRip2rXAN9nwI=
+golang.org/x/text v0.3.4-0.20201021145329-22f1617af38e/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
diff --git a/plugins/base/routes.go b/plugins/base/routes.go
index 7a8b845..61d92a6 100644
--- a/plugins/base/routes.go
+++ b/plugins/base/routes.go
@@ -691,10 +691,13 @@ func handleComposeNew(ctx *alps.Context) error {
// These are common mailto URL query parameters
// TODO: cc, bcc
+ var hdr mail.Header
+ hdr.GenerateMessageID()
+ mid, _ := hdr.MessageID()
return handleCompose(ctx, &OutgoingMessage{
To: strings.Split(ctx.QueryParam("to"), ","),
Subject: ctx.QueryParam("subject"),
- MessageID: mail.GenerateMessageID(),
+ MessageID: "<" + mid + ">",
InReplyTo: ctx.QueryParam("in-reply-to"),
Text: text,
}, &composeOptions{})
@@ -803,7 +806,10 @@ func handleReply(ctx *alps.Context) error {
return echo.NewHTTPError(http.StatusBadRequest, err)
}
- msg.MessageID = mail.GenerateMessageID()
+ var hdr mail.Header
+ hdr.GenerateMessageID()
+ mid, _ := hdr.MessageID()
+ msg.MessageID = "<" + mid + ">"
msg.InReplyTo = inReplyTo.Envelope.MessageId
// TODO: populate From from known user addresses and inReplyTo.Envelope.To
replyTo := inReplyTo.Envelope.ReplyTo
@@ -867,7 +873,10 @@ func handleForward(ctx *alps.Context) error {
return echo.NewHTTPError(http.StatusBadRequest, err)
}
- msg.MessageID = mail.GenerateMessageID()
+ var hdr mail.Header
+ hdr.GenerateMessageID()
+ mid, _ := hdr.MessageID()
+ msg.MessageID = "<" + mid + ">"
msg.Subject = source.Envelope.Subject
if !strings.HasPrefix(strings.ToLower(msg.Subject), "fwd:") &&
!strings.HasPrefix(strings.ToLower(msg.Subject), "fw:") {
diff --git a/plugins/base/smtp.go b/plugins/base/smtp.go
index f098506..1809059 100644
--- a/plugins/base/smtp.go
+++ b/plugins/base/smtp.go
@@ -123,11 +123,19 @@ func writeAttachment(mw *mail.Writer, att Attachment) error {
}
func (msg *OutgoingMessage) WriteTo(w io.Writer) error {
- from := []*mail.Address{{"", msg.From}}
+ fromAddr, err := mail.ParseAddress(msg.From)
+ if err != nil {
+ return err
+ }
+ from := []*mail.Address{fromAddr}
to := make([]*mail.Address, len(msg.To))
- for i, addr := range msg.To {
- to[i] = &mail.Address{"", addr}
+ for i, rcpt := range msg.To {
+ addr, err := mail.ParseAddress(rcpt)
+ if err != nil {
+ return err
+ }
+ to[i] = addr
}
var h mail.Header
@@ -182,13 +190,15 @@ func (msg *OutgoingMessage) WriteTo(w io.Writer) error {
}
func sendMessage(c *smtp.Client, msg *OutgoingMessage) error {
- if err := c.Mail(msg.From, nil); err != nil {
+ addr, _ := mail.ParseAddress(msg.From)
+ if err := c.Mail(addr.Address, nil); err != nil {
return fmt.Errorf("MAIL FROM failed: %v", err)
}
for _, to := range msg.To {
- if err := c.Rcpt(to); err != nil {
- return fmt.Errorf("RCPT TO failed: %v", err)
+ addr, _ := mail.ParseAddress(to)
+ if err := c.Rcpt(addr.Address); err != nil {
+ return fmt.Errorf("RCPT TO failed: %v (%s)", err, addr.Address)
}
}
diff --git a/themes/alps/compose.html b/themes/alps/compose.html
index 1f0a4e3..75345b2 100644
--- a/themes/alps/compose.html
+++ b/themes/alps/compose.html
@@ -22,12 +22,10 @@
{{ $to = "" }}
{{ end }}
<input
- type="email"
+ type="text"
name="to"
id="to"
value="{{$to}}"
- multiple
- list="emails"
{{ if not $to }} autofocus{{ end }}
/>