aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/send.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-12-20 20:29:12 +0100
committerRobin Jarry <robin@jarry.cc>2023-01-04 22:57:31 +0100
commit37e9a924894db7e5f232e82066155a60827c339b (patch)
tree48deeeea33113bbc9e6fcbcb8973a3ba1d62a06d /commands/compose/send.go
parentc56027b2e69ec198e41394e5cf906273d80baf79 (diff)
downloadaerc-37e9a924894db7e5f232e82066155a60827c339b.tar.gz
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 <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'commands/compose/send.go')
-rw-r--r--commands/compose/send.go11
1 files changed, 1 insertions, 10 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,
}