diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/compose/send.go | 11 | ||||
-rw-r--r-- | commands/msg/invite.go | 16 | ||||
-rw-r--r-- | commands/msg/reply.go | 16 |
3 files changed, 7 insertions, 36 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go index 4c2b0503..5af725c4 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -80,15 +80,6 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error { return errors.Wrap(err, "listRecipients") } - if config.From == "" { - return errors.New("No 'From' configured for this account") - } - // TODO: the user could conceivably want to use a different From and sender - from, err := mail.ParseAddress(config.From) - if err != nil { - return errors.Wrap(err, "ParseAddress(config.From)") - } - uri, err := url.Parse(outgoing) if err != nil { return errors.Wrap(err, "url.Parse(outgoing)") @@ -107,7 +98,7 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error { scheme: scheme, auth: auth, starttls: starttls, - from: from, + from: config.From, rcpts: rcpts, } diff --git a/commands/msg/invite.go b/commands/msg/invite.go index 2dca259b..ef28b91c 100644 --- a/commands/msg/invite.go +++ b/commands/msg/invite.go @@ -62,20 +62,10 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error { } conf := acct.AccountConfig() - from, err := mail.ParseAddress(conf.From) - if err != nil { - return err - } - var aliases []*mail.Address - if conf.Aliases != "" { - aliases, err = mail.ParseAddressList(conf.Aliases) - if err != nil { - return err - } - } + from := conf.From // figure out the sending from address if we have aliases - if len(aliases) != 0 { + if len(conf.Aliases) != 0 { rec := newAddrSet() rec.AddList(msg.Envelope.To) rec.AddList(msg.Envelope.Cc) @@ -83,7 +73,7 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error { if rec.Contains(from) { // do nothing } else { - for _, a := range aliases { + for _, a := range conf.Aliases { if rec.Contains(a) { from = a break diff --git a/commands/msg/reply.go b/commands/msg/reply.go index 52265950..795158ca 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -71,17 +71,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("No account selected") } conf := acct.AccountConfig() - from, err := mail.ParseAddress(conf.From) - if err != nil { - return err - } - var aliases []*mail.Address - if conf.Aliases != "" { - aliases, err = mail.ParseAddressList(conf.Aliases) - if err != nil { - return err - } - } + from := conf.From store := widget.Store() if store == nil { @@ -93,7 +83,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { } // figure out the sending from address if we have aliases - if len(aliases) != 0 { + if len(conf.Aliases) != 0 { rec := newAddrSet() rec.AddList(msg.Envelope.To) rec.AddList(msg.Envelope.Cc) @@ -101,7 +91,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { if rec.Contains(from) { // do nothing } else { - for _, a := range aliases { + for _, a := range conf.Aliases { if rec.Contains(a) { from = a break |