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>
This commit is contained in:
parent
d39da95f73
commit
40d298b8d8
1 changed files with 10 additions and 0 deletions
|
@ -525,6 +525,7 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var subject string
|
var subject string
|
||||||
|
var body string
|
||||||
h := &mail.Header{}
|
h := &mail.Header{}
|
||||||
to, err := mail.ParseAddressList(addr.Opaque)
|
to, err := mail.ParseAddressList(addr.Opaque)
|
||||||
if err != nil && addr.Opaque != "" {
|
if err != nil && addr.Opaque != "" {
|
||||||
|
@ -533,6 +534,14 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
|
||||||
h.SetAddressList("to", to)
|
h.SetAddressList("to", to)
|
||||||
for key, vals := range addr.Query() {
|
for key, vals := range addr.Query() {
|
||||||
switch strings.ToLower(key) {
|
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":
|
case "cc":
|
||||||
list, err := mail.ParseAddressList(strings.Join(vals, ","))
|
list, err := mail.ParseAddressList(strings.Join(vals, ","))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -561,6 +570,7 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
composer.SetContents(strings.NewReader(body))
|
||||||
composer.FocusSubject()
|
composer.FocusSubject()
|
||||||
title := "New email"
|
title := "New email"
|
||||||
if subject != "" {
|
if subject != "" {
|
||||||
|
|
Loading…
Reference in a new issue