aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--widgets/aerc.go10
2 files changed, 11 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3ab262e..e897e4b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Specify opener as the first `:open` param instead of always using default
handler (i.e. `:open gimp` to open attachment in GIMP).
- Restored XOAUTH2 support for IMAP and SMTP.
+- Support for attaching files with `mailto:`-links
### Changed
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 56972771..35c32fe3 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -644,6 +644,7 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
var subject string
var body string
var acctName string
+ var attachments []string
h := &mail.Header{}
to, err := mail.ParseAddressList(addr.Opaque)
if err != nil && addr.Opaque != "" {
@@ -679,6 +680,11 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
case "subject":
subject = strings.Join(vals, ",")
h.SetText("Subject", subject)
+ case "attach":
+ for _, path := range vals {
+ // remove a potential file:// prefix.
+ attachments = append(attachments, strings.TrimPrefix(path, "file://"))
+ }
default:
// any other header gets ignored on purpose to avoid control headers
// being injected
@@ -720,6 +726,10 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
}
ui.Invalidate()
})
+
+ for _, file := range attachments {
+ composer.AddAttachment(file)
+ }
return nil
}