aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/forward.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msg/forward.go')
-rw-r--r--commands/msg/forward.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index c8e04f17..9b234efa 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -41,10 +41,18 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
}
attach := false
template := ""
+ var tolist []*mail.Address
for _, opt := range opts {
switch opt.Option {
case 'A':
attach = true
+ to := strings.Join(args[optind:], ", ")
+ if strings.Contains(to, "@") {
+ tolist, err = mail.ParseAddressList(to)
+ if err != nil {
+ return fmt.Errorf("invalid to address(es): %v", err)
+ }
+ }
case 'T':
template = opt.Value
}
@@ -69,12 +77,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
subject := "Fwd: " + msg.Envelope.Subject
h.SetSubject(subject)
- if len(args) != 1 {
- to := strings.Join(args[optind:], ", ")
- tolist, err := mail.ParseAddressList(to)
- if err != nil {
- return fmt.Errorf("invalid to address(es): %v", err)
- }
+ if len(tolist) > 0 {
h.SetAddressList("to", tolist)
}