From 37e9a924894db7e5f232e82066155a60827c339b Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 20 Dec 2022 20:29:12 +0100 Subject: config: parse account from and aliases once Instead of accepting any garbage for these configuration fields, parse them when parsing accounts.conf and store mail.Address objects. Reuse these objects everywhere. Signed-off-by: Robin Jarry Acked-by: Tim Culverhouse --- commands/compose/send.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'commands/compose/send.go') 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, } -- cgit