aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-03-18 11:05:26 -0500
committerRobin Jarry <robin@jarry.cc>2022-03-18 21:25:44 +0100
commit40d298b8d85b30df051682545f42fe7031bd136c (patch)
treeb0fc6cd471064520f3b1baccdf2dc4ddffe71753 /widgets
parentd39da95f738f8b510f242995e73f6d67409d55e2 (diff)
downloadaerc-40d298b8d85b30df051682545f42fe7031bd136c.tar.gz
mailto: handle bcc and body fields
Enable handling of bcc and body fields in mailto links Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/aerc.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 64b872c5..3a8f47fd 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -525,6 +525,7 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
}
var subject string
+ var body string
h := &mail.Header{}
to, err := mail.ParseAddressList(addr.Opaque)
if err != nil && addr.Opaque != "" {
@@ -533,6 +534,14 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
h.SetAddressList("to", to)
for key, vals := range addr.Query() {
switch strings.ToLower(key) {
+ case "bcc":
+ list, err := mail.ParseAddressList(strings.Join(vals, ","))
+ if err != nil {
+ break
+ }
+ h.SetAddressList("Bcc", list)
+ case "body":
+ body = strings.Join(vals, "\n")
case "cc":
list, err := mail.ParseAddressList(strings.Join(vals, ","))
if err != nil {
@@ -561,6 +570,7 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
if err != nil {
return nil
}
+ composer.SetContents(strings.NewReader(body))
composer.FocusSubject()
title := "New email"
if subject != "" {