webmail: implement registering and handling "mailto:" links

to start composing a message.

the help popup now has a button to register the "mailto:" links with the mox
webmail (typically only works over https, not all browsers support it).

the mailto links are specified in 6068. we support the to/cc/bcc/subject/body
parameters. other parameters should be seen as custom headers, but we don't
support messages with custom headers at all at the moment, so we ignore them.

we now also turn text of the form "mailto:user@host" into a clickable link
(will not be too common). we could be recognizing any "x@x.x" as email address
and make them clickable in the future.

thanks to Hans-Jörg for explaining this functionality.
This commit is contained in:
Mechiel Lukkien
2024-02-09 11:21:33 +01:00
parent f3bf348214
commit ee1db2dde7
9 changed files with 309 additions and 20 deletions

View File

@ -1782,6 +1782,13 @@ func recipientSecurity(ctx context.Context, resolver dns.Resolver, messageAddres
return rs, nil
}
// DecodeMIMEWords decodes Q/B-encoded words for a mime headers into UTF-8 text.
func (Webmail) DecodeMIMEWords(ctx context.Context, text string) string {
s, err := wordDecoder.DecodeHeader(text)
xcheckuserf(ctx, err, "decoding mime q/b-word encoded header")
return s
}
func slicesAny[T any](l []T) []any {
r := make([]any, len(l))
for i, v := range l {